package cn.fl.audit.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.api.IUploadApiService;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.dto.SysUlFilesRecDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.ISysUsrApiService;
import cmm.user.facade.system.api.ISysUsrQueryApiService;
import cmm.user.facade.system.dto.SysUsrDTO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.audit.constant.AudStandingBookConstant;
import cn.fl.audit.service.IAudCreditInfoService;
import cn.fl.audit.service.IAudReturnVisitService;
import cn.fl.audit.vo.*;
import cn.fl.commons.result.ResponseData;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.inscare.transform.InsVehicleLicenseVOTransform;
import cn.fl.inscare.transform.SysUlFilesRecVOTransform;
import cn.fl.inscare.vo.InsVehicleLicenseVO;
import cn.fl.inscare.vo.SysUlFilesRecVO;
import cn.fl.mcr.api.IMcrCstCreditRecApiService;
import cn.fl.mcr.constant.UploadConstant;
import cn.fl.mcr.service.IMcrCstCreditRecService;
import cn.fl.mcr.vo.McrVisitVO;
import cn.fl.preloan.IAuditOpeLineService;
import cn.fl.preloan.IAuditReturnVisitService;
import cn.fl.preloan.condition.AuditReturnVisitQueryCondition;
import cn.fl.preloan.dto.audit.*;
import cn.fl.project.condition.PrjPrdBscInfoQueryCondition;
import cn.fl.project.condition.PrjPrdDtlQueryCondition;
import cn.fl.project.service.IPrjBscInfoService;
import cn.fl.project.service.IPrjPrdBscInfoService;
import cn.fl.project.service.IPrjPrdDtlService;
import cn.fl.project.service.IProjectApiService;
import cn.fl.project.vo.PrjBscInfoVO;
import cn.fl.project.vo.PrjPrdBscInfoVO;
import cn.fl.project.vo.PrjPrdDtlVO;
import cn.fl.retvisit.dto.AudReturnVisitDTO;
import cn.fl.retvisit.dto.AudVisitAgrDTO;
import cn.fl.retvisit.dto.AudVisitCarDTO;
import cn.fl.retvisit.dto.AudVisitRecordDTO;
import cn.fl.retvisit.dto.AudVisitTkDTO;
import cn.fl.risk.constant.RiskConstant;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysRegionService;
import cn.lionbridgecapital.loan.model.condition.McrVisitCarBusQC;
import cn.lionbridgecapital.loan.model.condition.McrVisitCarQC;
import cn.lionbridgecapital.loan.model.condition.McrVisitDriverQC;
import cn.lionbridgecapital.loan.model.condition.McrVisitProposerQC;
import cn.lionbridgecapital.loan.model.constant.McrCstCrLimAppConstant;
import cn.lionbridgecapital.loan.model.dto.McrVisitCarBusDTO;
import cn.lionbridgecapital.loan.model.dto.McrVisitCarDTO;
import cn.lionbridgecapital.loan.model.dto.McrVisitDriverDTO;
import cn.lionbridgecapital.loan.model.dto.McrVisitProposerDTO;
import cn.lionbridgecapital.loan.service.api.IMcrOutLoanApiService;
import cn.lionbridgecapital.loan.service.api.IMcrTripartiteApiService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.SystemConstant;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.api.ICustomerQueryApiService;
import fl.customer.facade.customer.condition.CstCorpTeamQueryCondition;
import fl.customer.facade.customer.dto.CstBscInfoDTO;
import fl.customer.facade.customer.dto.CstCorpTeamDTO;
import fl.customer.facade.customer.dto.CstNpBscInfoDTO;
import ins.car.facade.car.car.api.IInsModifyApiService;
import ins.car.facade.car.car.api.IInsQueryApiService;
import ins.car.facade.car.car.common.MoneyConvert;
import ins.car.facade.car.car.dto.InsVehicleLicenseDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;

/**
 * @Description: 信审回访表 控制层
 */
@Controller
@RequestMapping("/audit/audReturnVisit")
public class AudReturnVisitController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(AudReturnVisitController.class);

    /**
     * AudReturnVisit 服务层BEAN
     */
    @Autowired
    private IAudReturnVisitService audReturnVisitService;
    @Autowired
    private ISysRegionService sysRegionService;
    /*
     * 项目信息服务
     */
    @Autowired
    private IPrjBscInfoService prjBscInfoService;

    /**
     * 项目产品信息服务
     */
    @Autowired
    private IPrjPrdBscInfoService prjPrdBscInfoService;

    /**
     * 用户服务
     */
    @Autowired
    private ISysUsrApiService sysUsrApiService;

    /**
     * 客户服务
     */
    @Autowired
    private ICustomerQueryApiService customerQueryApiService;

    @Autowired
    private ICustomerApiService customerApiService;

    /**
     * 项目API服务
     */
    @Autowired
    private IProjectApiService projectApiService;

    /**
     * 数据字典API服务
     */
    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;

    /**
     * 信审整体资料 客户端服务层接口
     */
    @Autowired
    private IAudCreditInfoService audCreditInfoService;

    @Autowired
    private ISysUsrQueryApiService sysUsrQueryApiService;

    @Autowired
    private IMcrCstCreditRecService mcrCstCreditRecService;

    @Autowired
	private IMcrCstCreditRecApiService mcrCstCreditRecApiService;

    @Autowired
    private IUploadApiService uploadApiService;

    @Autowired
    private IInsQueryApiService insQueryApiService;

    @Autowired
    private IInsModifyApiService insModifyApiService;

    @Autowired
    private IPrjPrdDtlService prjPrdDtlService; //项目产品明细信息表 客户端服务层接口

    @Autowired
    private IMcrTripartiteApiService mcrTripartiteApiService; // 三方接口（车辆信息）
    @Autowired
    private IMcrOutLoanApiService mcrOutLoanApiService; // 外部小贷

    @Autowired
    private IAuditReturnVisitService auditReturnVisitService;

    @Autowired
    private IAuditOpeLineService auditOpeLineService;
    


    /**
     * 到列表页面
     */
    @RequestMapping(value = "/toListPage.do", method = {RequestMethod.GET})
    public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audReturnVisitList");
        //审批类型
        List<SysDictionaryDTO> SCHR6List = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.RC_CP_MOD_EXT_INFO_SCHR6);
        view.addObject("SCHR6List", SCHR6List);
        BaseLogUtils.info(logger, "toListPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到新增/修改页面-回访信息   modifyAudOpeLine
     */
    @RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        String projectId = request.getParameter("projectId");//项目ID
        String proIntId = request.getParameter("proIntId");//流程实例ID
        String prjTypCd = request.getParameter("prjTypCd");//任务KEY
        String prdTypCd = request.getParameter("prdTypCd");//项目产品类型
        String isDetail = request.getParameter("isDetail");//是否详情标识(1:详情页面不可编辑,操作按钮隐藏)
        String buOrgCd = request.getParameter("buOrgCd");//项目所属事业部
        String insCode = request.getParameter("insCode");//机构code
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audReturnVisitAdd");
		view.addObject("sysDate", DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DD));//系统当前时间
        view.addObject("projectId", projectId);
        view.addObject("proIntId", proIntId);
        view.addObject("prjTypCd", prjTypCd);
        view.addObject("insCode", insCode);
        AudReturnVisitVO vo = this.audReturnVisitService.selectByProjectIdAndProIntId(Long.valueOf(projectId));
		/*if(vo != null &&StringUtils.isNotBlank(vo.getCircuitType())){
			view.addObject("circuitType", vo.getCircuitType());
		}
		if(vo != null &&StringUtils.isNotBlank(vo.getCargoWeigth())){
			view.addObject("cargoWeigth", vo.getCargoWeigth());
		}
		if(vo != null &&StringUtils.isNotBlank(vo.getCargoVomule())){
			view.addObject("cargoVomule", vo.getCargoVomule());
		}
		if(vo != null &&StringUtils.isNotBlank(vo.getHandingMode())){
			view.addObject("handingMode", vo.getHandingMode());
		}
		if(vo != null &&StringUtils.isNotBlank(vo.getCircuitEfficiency())){
			view.addObject("circuitEfficiency", vo.getCircuitEfficiency());
		}
		if(vo != null &&StringUtils.isNotBlank( vo.getFare())){
			view.addObject("Fare", vo.getFare());
		}*/
        if (null != vo.getId()) {
            GetAudOpeLineByVisitIdRequest getRequest = new GetAudOpeLineByVisitIdRequest();
            getRequest.setVisitId(vo.getId());
            getRequest.setSysCd(CurrentThreadContext.getCurrentSysCd());
            ResponseData<List<AuditOpeLineDTO>> responseData = auditOpeLineService.getAudvisitOperateLineByVisitId(getRequest);
            List<AudOpeLineVO> audOpeLineList = new ArrayList<>();
            if (responseData != null && ResponseData.SUCCESS_CODE.equals(responseData.getCode()) && responseData.getData() != null) {
                List<AuditOpeLineDTO> auditOpeLineDTOS = responseData.getData();
                for (AuditOpeLineDTO auditOpeLineDTO : auditOpeLineDTOS) {
                    AudOpeLineVO audOpeLineVO = new AudOpeLineVO();
                    BeanUtils.copyProperties(auditOpeLineDTO, audOpeLineVO);
                    audOpeLineList.add(audOpeLineVO);
                }
            }
            if (null != audOpeLineList && audOpeLineList.size() != 0) {
                view.addObject("audOpeLineList", audOpeLineList);
                view.addObject("size", audOpeLineList.size());
            } else {
                view.addObject("size", null);
            }
        } else {
            view.addObject("size", null);
        }


        PrjPrdBscInfoQueryCondition prjPrdQc = new PrjPrdBscInfoQueryCondition();
        if (StringUtils.isNotEmpty(projectId)) {
        	prjPrdQc.setPrjId(Long.valueOf(projectId));
        }
        List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = this.prjPrdBscInfoService.searchList(prjPrdQc);
        if (CollectionUtils.isNotEmpty(prjPrdBscInfoVOList)) {
        	if (StringUtils.isEmpty(prdTypCd)) {
        		prdTypCd = prjPrdBscInfoVOList.get(0).getPrdTypCd();
        	}
            //页面首次初始化需要-REQ-3024
            Long zPrjPrdId_1st = null; //项目产品基础信息ID(主车)
            Long gPrjPrdId_1st = null; //项目产品基础信息ID(挂车)
            int equipmentNum_1st = 0; //设备数量
            String isExistTrunc_1st = "0"; //是否含挂车:0 否; 1 是
            StringBuffer mainMarketPrice_1st = new StringBuffer(); //主车价格
            StringBuffer truncMarketPrice_1st = new StringBuffer(); //挂车价格
            String vehiclesDoorCd_1st = "1"; //车辆上户:1 个人户; 2 挂靠公司户
            int n = 0; //计数使用
            List<Long> prjPrdIds = new ArrayList<Long>();
            for(PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList){
            	n++;
            	if(StringUtils.isNotEmpty(prjPrdBscInfoVO.getId())){
            		//获取项目产品ID
            		prjPrdIds.add(prjPrdBscInfoVO.getId());
                	//判断是否为挂车
                	if("9".equals(prjPrdBscInfoVO.getPrdTypCd())){ //挂车
                		isExistTrunc_1st = "1"; //含挂车
                		gPrjPrdId_1st = prjPrdBscInfoVO.getId();
                		truncMarketPrice_1st.append(prjPrdBscInfoVO.getGuidePc());
                		if(n != prjPrdBscInfoVOList.size()){
                			truncMarketPrice_1st.append("；");
                		}
                	}else{
                		equipmentNum_1st += 1; //加1
                		zPrjPrdId_1st = prjPrdBscInfoVO.getId();
                		mainMarketPrice_1st.append(prjPrdBscInfoVO.getGuidePc());
                		if(n != prjPrdBscInfoVOList.size()){
                			mainMarketPrice_1st.append("；");
                		}
                	}
            	}
            }
            //判断是否添加挂靠公司
            PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
            if (StringUtils.isNotEmpty(projectId)) {
            	prjPrdDtlQc.setPrjId(Long.valueOf(projectId));
            }
            prjPrdDtlQc.setPrjPrdIds(prjPrdIds);
            List<PrjPrdDtlVO>  prjPrdDtlVOList = this.prjPrdDtlService.selectList(prjPrdDtlQc);
            if (CollectionUtils.isNotEmpty(prjPrdDtlVOList)) {
            	n = 0;
            	for(PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOList){
            		if(StringUtils.isNotEmpty(prjPrdDtlVO.getLnkCompId())){
            			vehiclesDoorCd_1st = "2"; //个人户
            		}
            	}
            }
            view.addObject("zPrjPrdId_1st", zPrjPrdId_1st); //项目产品基础信息ID(主车)
            view.addObject("gPrjPrdId_1st", gPrjPrdId_1st); //项目产品基础信息ID(挂车)
            view.addObject("equipmentNum_1st", equipmentNum_1st); //设备数量
            view.addObject("isExistTrunc_1st", isExistTrunc_1st); //是否含挂车
            view.addObject("mainMarketPrice_1st", mainMarketPrice_1st); //主车价格
            view.addObject("truncMarketPrice_1st", truncMarketPrice_1st); //挂车价格
            view.addObject("vehiclesDoorCd_1st", vehiclesDoorCd_1st); //车辆上户
        }
        view.addObject("prdTypCd", prdTypCd);
        view.addObject("isDetail", isDetail);
        //查询承租人姓名 客户经理
        try {
            if (StringUtils.isNotEmpty(projectId)) {
                PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(projectId));
                if (null != prjBscInfoVO) {
                    view.addObject("cstNm", prjBscInfoVO.getCstNm());//客户名称
                    view.addObject("cstMgrId", prjBscInfoVO.getCstMgrId());//客户经理ID
                    view.addObject("cstMgrNm", prjBscInfoVO.getCstMgrNm());//客户经理名称
                    view.addObject("buOrgCd", prjBscInfoVO.getBuOrgCd());//项目所属事业部代码
                    //获取承租人手机号1、法人代表-手机号1信息-REQ-3024
                    Long cstId=prjBscInfoVO.getCstId();
                    if(StringUtils.isNotEmpty(cstId)){
                    	//查询客户基本信息-获取客户分类：1自然人;2法人
                    	CstBscInfoDTO cstBscInfoDTO = this.customerQueryApiService.getCstBscInfoById(cstId);
                    	if(null != cstBscInfoDTO){
                    		if("1".equals(cstBscInfoDTO.getCstTypCd())){//自然人
		                    	CstNpBscInfoDTO cstNpBscInfoDTO = this.customerQueryApiService.getCstNpBscInfoById(cstId);
		                    	if (null != cstNpBscInfoDTO) {
		                    		view.addObject("phone_1st", cstNpBscInfoDTO.getMp1());//承租人-手机号1
		                    	}
                    		}else {//法人
                    			CstCorpTeamQueryCondition teamQc = new CstCorpTeamQueryCondition();
                    			teamQc.setCstId(cstId);
                    			teamQc.setmTypCd("1");//法人代表
                    			List<CstCorpTeamDTO> cstCorpTeamList = this.customerApiService.searchCstCorpTeamList(teamQc);
                    			if(CollectionUtils.isNotEmpty(cstCorpTeamList) && cstCorpTeamList.size()>0){
                    				CstCorpTeamDTO cstCorpTeamDTO = cstCorpTeamList.get(0);
                    				if (null != cstCorpTeamDTO) {
    		                    		view.addObject("phone_1st", cstCorpTeamDTO.getMp1());//法人代表-手机号1
    		                    	}
                    			}
							}
                    	}
                    }
                }
            }
        } catch (BaseException e) {
            BaseLogUtils.info(logger, "", "跳转回访信息页面查询项目信息发生异常.Detail:" + e.getMessage());
        } catch (Exception e) {
            BaseLogUtils.info(logger, "", "跳转回访信息页面查询项目信息发生异常.Detail:" + e.getMessage());
        }
        //查询当前登录人
        view.addObject("userId", CurrentThreadContext.getCurrentUserId());
        view.addObject("userNm", CurrentThreadContext.getCurrentUserName());
        /**
         * 信审员 支持选择 而不是取当前登录人
         */
        //查数据字典-->评审人员角色ID
        List<SysUsrDTO> auditUsrList = new ArrayList<SysUsrDTO>();
        List<SysDictionaryDTO> dicList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), RiskConstant.CODE_COLLECTOR_ROLE_CD);
        if (CollectionUtils.isNotEmpty(dicList)) {
            SysDictionaryDTO sysDictionaryDTO = dicList.get(0);
            if (null != sysDictionaryDTO) {
                String roleIdString = sysDictionaryDTO.getCode();
                if (StringUtils.isNotEmpty(roleIdString)) {
                    auditUsrList = this.sysUsrQueryApiService.searchAuthSysUsrListByRoleId(Long.valueOf(roleIdString), CurrentThreadContext.getCurrentSysCd());//信审员集合
                }
            }
        }
        /**
         * 预览担保人备注
         */
		/*String previewGuarantorRem = "";
		if(StringUtils.isNotEmpty(projectId)){
			previewGuarantorRem = this.audReturnVisitService.previewGuarantorRem(Long.valueOf(projectId));
		}
		view.addObject("previewGuarantorRem", previewGuarantorRem);*/

        List<KeyValueVO> auditUsrKVList = new ArrayList<KeyValueVO>();
        if (CollectionUtils.isNotEmpty(auditUsrList)) {
            for (SysUsrDTO sysUsrDTO : auditUsrList) {
                KeyValueVO kv = new KeyValueVO();
                kv.setKey(sysUsrDTO.getId().toString());
                kv.setValue(sysUsrDTO.getRefRlNm());
                auditUsrKVList.add(kv);
            }
        }
        view.addObject("auditUsrKVListJSON", JSON.toJSON(auditUsrKVList));

        //下拉数据
        //是否
        List<KeyValueVO> yesOrNoTypeCdList = this.audReturnVisitService.searchYesOrNoTypeCdList();
        view.addObject("yesOrNoTypeCdList", yesOrNoTypeCdList);
        view.addObject("yesOrNoTypeCdListJSON", JSON.toJSON(yesOrNoTypeCdList));
        //信息确认(一致/不一致)
        List<KeyValueVO> returnVisitConfirmCdList = this.audReturnVisitService.searchReturnVisitConfirmCdList();
        view.addObject("returnVisitConfirmCdList", returnVisitConfirmCdList);
        view.addObject("returnVisitConfirmCdListJSON", JSON.toJSON(returnVisitConfirmCdList));
        //提车情况
        List<KeyValueVO> pickCardCdList = this.audReturnVisitService.searchPickCardCdList();
        view.addObject("pickCardCdList", pickCardCdList);
        //上牌情况
        List<KeyValueVO> statusCdList = this.audReturnVisitService.searchStatusCdList();
        view.addObject("statusCdList", statusCdList);
        //回访人员类型下拉数据
        List<KeyValueVO> personnelTypeCdList = this.audReturnVisitService.searchPersonnelTypeCdList();
        //过滤掉承租人回访
        if (CollectionUtils.isNotEmpty(personnelTypeCdList)) {
            List<KeyValueVO> removeList = new ArrayList<KeyValueVO>();
            for (KeyValueVO kv : personnelTypeCdList) {
                if (kv.getKey().equals(AudStandingBookConstant.AUD_PER_TYP_CD_TEN)) {
                    removeList.add(kv);
                }
            }
            personnelTypeCdList.removeAll(removeList);
        }
        view.addObject("personnelTypeCdListJSON", JSON.toJSON(personnelTypeCdList));
        //与承租人关系
        List<KeyValueVO> relationshipCdList = this.audReturnVisitService.searchRelationshipCdList();
        view.addObject("relationshipCdListJSON", JSON.toJSON(relationshipCdList));

        //收入方式
        List<KeyValueVO> profitCdList = this.audReturnVisitService.searchProfitCdList(CurrentThreadContext.getCurrentSysCd(), buOrgCd);
        view.addObject("profitCdList", profitCdList);
        //运营年限
        List<KeyValueVO> bizExpList = this.audReturnVisitService.searchBizExpList();
        view.addObject("bizExpList", bizExpList);
        //主货物大类
        List<KeyValueVO> mainGdsTypCdList = this.audCreditInfoService.searchGoodsTypListByLvl("1");
        view.addObject("mainGdsTypCdList", mainGdsTypCdList);
        //货物来源
        List<KeyValueVO> goodsResList = this.audReturnVisitService.searchGoodsResList();
        view.addObject("goodsResList", goodsResList);
        //主货物结算方式
        List<KeyValueVO> gdsStlWayCdList = this.audReturnVisitService.searchGdsStlWayCdList();
        view.addObject("gdsStlWayCdList", gdsStlWayCdList);
        //司机情况
        List<KeyValueVO> driverList = this.audReturnVisitService.searchDriverList();
        view.addObject("driverList", driverList);
        //第二还款来源
        List<KeyValueVO> secondPayResCdList = this.audReturnVisitService.searchSecondPayResCdList();
        view.addObject("secondPayResCdList", secondPayResCdList);

        //代扣卡
        List<KeyValueVO> agentCardStateCdList = this.audReturnVisitService.searchAgentCardStateCdList();
        view.addObject("agentCardStateCdList", agentCardStateCdList);
        //设备位置
        List<KeyValueVO> eqmtAddressCdList = this.audReturnVisitService.searchEqmtAddressCdList();
        view.addObject("eqmtAddressCdList", eqmtAddressCdList);
        //车辆上户
        List<KeyValueVO> vehiclesDoorCdList = this.audReturnVisitService.searchVehiclesDoorCdList();
        view.addObject("vehiclesDoorCdList", vehiclesDoorCdList);

        List<KeyValueVO> powerCdList = this.audReturnVisitService.searchPowerCdList();
        view.addObject("powerCdList", powerCdList);
        //线路类型
        List<KeyValueVO> CircuitTypeCd = this.audReturnVisitService.searchCircuitTypeList();
        view.addObject("CircuitTypeCd", CircuitTypeCd);
        //装卸方式
        List<KeyValueVO> HanglingModeCd = this.audReturnVisitService.searchHanglingModeList();
        view.addObject("HanglingModeCd", HanglingModeCd);
        //区域

        BaseLogUtils.info(logger, "toAddPage", "跳转到修改页面.[projectId=" + projectId + ",proIntId=" + proIntId + "]", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到新增/修改页面-后续回访记录
     */
    @RequestMapping(value = "/toFlowVisitAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toFlowVisitAddPage(HttpServletRequest request, HttpServletResponse response) {
        String visitId = request.getParameter("visitId");//回访信息ID
        String projectId = request.getParameter("projectId");//项目ID
        String isDetail = request.getParameter("isDetail");//是否详情标识(1:详情页面不可编辑,操作按钮隐藏)
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audFlowReturnVisitAdd");
        view.addObject("visitId", visitId);
        view.addObject("isDetail", isDetail);
        //查询客户经理
        if (StringUtils.isNotEmpty(projectId)) {
            PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(projectId));
            if (null != prjBscInfoVO) {
                view.addObject("cstMgrId", prjBscInfoVO.getCstMgrId());//客户经理ID
                view.addObject("cstMgrNm", prjBscInfoVO.getCstMgrNm());//客户经理名称
            }
        }
        //查询当前登录人
        view.addObject("userId", CurrentThreadContext.getCurrentUserId());
        view.addObject("userNm", CurrentThreadContext.getCurrentUserName());
        /**
         * 信审员 支持选择 而不是取当前登录人
         */
        //查数据字典-->评审人员角色ID
        List<SysUsrDTO> auditUsrList = new ArrayList<SysUsrDTO>();
        List<SysDictionaryDTO> dicList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), RiskConstant.CODE_COLLECTOR_ROLE_CD);
        if (CollectionUtils.isNotEmpty(dicList)) {
            SysDictionaryDTO sysDictionaryDTO = dicList.get(0);
            if (null != sysDictionaryDTO) {
                String roleIdString = sysDictionaryDTO.getCode();
                if (StringUtils.isNotEmpty(roleIdString)) {
                    auditUsrList = this.sysUsrQueryApiService.searchAuthSysUsrListByRoleId(Long.valueOf(roleIdString), CurrentThreadContext.getCurrentSysCd());//信审员集合
                }
            }
        }

        List<KeyValueVO> auditUsrKVList = new ArrayList<KeyValueVO>();
        if (CollectionUtils.isNotEmpty(auditUsrList)) {
            for (SysUsrDTO sysUsrDTO : auditUsrList) {
                KeyValueVO kv = new KeyValueVO();
                kv.setKey(sysUsrDTO.getId().toString());
                kv.setValue(sysUsrDTO.getRefRlNm());
                auditUsrKVList.add(kv);
            }
        }
        view.addObject("auditUsrKVListJSON", JSON.toJSON(auditUsrKVList));
        //回访人员类型下拉数据
        List<KeyValueVO> personnelTypeCdList = this.audReturnVisitService.searchPersonnelTypeCdList();
        view.addObject("personnelTypeCdListJSON", JSON.toJSON(personnelTypeCdList));
        BaseLogUtils.info(logger, "toFlowVisitAddPage", "跳转到后续回访记录新增/修改页面.[visitId=" + visitId + "]", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到动态字段组件页面-承租人回访非本人接听时增加字段
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toTenantVisitDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toTenantVisitDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audTenantVisitInfoDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-车辆确认
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toVehConfirmDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toVehConfirmDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audVehVisitInfoDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-融资方案
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toSchemeDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toSchemeDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audSchemeVisitInfoDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-农机新增
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toFarmDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toFarmDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audFarmSpecialDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-农机根据盈利方式刷新
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toMkMoneyDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toMkMoneyDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audFarmMkMoneyTpeDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-卡车新增
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toTkDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toTkDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audTkSpecialDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-卡车根据盈利方式刷新
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toTkMkMoneyDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toTkMkMoneyDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audTkMkMoneyTpeDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-乘用车新增
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toCarDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toCarDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audCarSpecialDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 到动态字段组件页面-农机根据盈利方式刷新
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toWorkTypDyncFldPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toWorkTypDyncFldPage(HttpServletRequest request, HttpServletResponse response) {
        String bizTypCd = request.getParameter("bizTypCd");
        String bizCd = request.getParameter("bizCd");
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audCarWorkTypDyncPage");
        if (StringUtils.isNotEmpty(bizTypCd) && StringUtils.isNotEmpty(bizCd)) {
            view.addObject("bizTypCd", bizTypCd);
            view.addObject("bizCd", bizCd);
        } else {
            view.addObject("bizTypCd", "");
            view.addObject("bizCd", "");
        }
        return view;
    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        String crtUsrNm = request.getParameter("crtUsrNm");//操作人/信审员
        String accountManagerNm = request.getParameter("accountManagerNm");//客户经理
        String cstNm = request.getParameter("cstNm");//承租人
        String phone = request.getParameter("phone");//承租人
        String crtStartDt = request.getParameter("crtStartDt");//回访日期(起)
        String crtEndDt = request.getParameter("crtEndDt");//回访日期(止)
        String schr6 = request.getParameter("schr6");//审批类型
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }

        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        AuditReturnVisitQueryCondition qc = new AuditReturnVisitQueryCondition();
        if (StringUtils.isNotEmpty(crtUsrNm)) {
            qc.setCrtUsrNm(crtUsrNm);
        }
        if (StringUtils.isNotEmpty(accountManagerNm)) {
            qc.setAccountManagerNm(accountManagerNm);
        }
        if (StringUtils.isNotEmpty(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotEmpty(phone)) {
            qc.setPhone(phone);
        }
        if (StringUtils.isNotEmpty(schr6)) {
            qc.setSchr_6(schr6);
        }
		/*if (StringUtils.isNotEmpty(crtUsrNm)) {
			SysUsrQueryCondition usrQC = new SysUsrQueryCondition();
			usrQC.setRlNm(crtUsrNm);
			usrQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
			List<SysUsrDTO> sysUsrList = this.sysUsrApiService.searchSysUsrList(usrQC);
			if(CollectionUtils.isNotEmpty(sysUsrList)){
				List<Long> crtUsrIdList = new ArrayList<Long>();
				for (SysUsrDTO sysUsrDTO : sysUsrList) {
					crtUsrIdList.add(sysUsrDTO.getId());
				}
				qc.setCrtUsrIdList(crtUsrIdList);
			}else{
				return new ListPageVO<AudReturnVisitVO>(new ArrayList<AudReturnVisitVO>(), 0);
			}
		}*/
        //客户经理-->IDLIST  客户-->IDLIST ==>项目IDLIST  ==> 设置条件
		/*if (StringUtils.isNotEmpty(accountManagerNm) || StringUtils.isNotEmpty(cstNm)) {
			SysUsrQueryCondition usrQC = new SysUsrQueryCondition();
			List<Long> cstMgrIdList = new ArrayList<Long>();//客户经理IDLIST
			if(StringUtils.isNotEmpty(accountManagerNm)){
				usrQC.setRlNm(accountManagerNm);
				usrQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				List<SysUsrDTO> sysUsrList = this.sysUsrApiService.searchSysUsrList(usrQC);
				if(CollectionUtils.isNotEmpty(sysUsrList)){
					for (SysUsrDTO sysUsrDTO : sysUsrList) {
						cstMgrIdList.add(sysUsrDTO.getId());
					}
				}
			}
			//——————————————————————————————————————————————————————————————————————————
			CstBscInfoQueryCondition cstQC = new CstBscInfoQueryCondition();
			List<Long> cstIdList = new ArrayList<Long>();//客户IDLIST
			if(StringUtils.isNotEmpty(cstNm)){
				cstQC.setCstNm(cstNm);
				List<CstBscInfoDTO> cstBscInfoList = this.customerQueryApiService.searchCstBscInfoList(cstQC);
				if(CollectionUtils.isNotEmpty(cstBscInfoList)){
					for (CstBscInfoDTO cstBscInfoDTO : cstBscInfoList) {
						cstIdList.add(cstBscInfoDTO.getId());
					}
				}
			}
			//查项目(客户经理IDList和客户IDLIST至少一个不为空)
			if(CollectionUtils.isNotEmpty(cstMgrIdList) || CollectionUtils.isNotEmpty(cstIdList)){
				PrjBscInfoQueryCondition prjQC = new PrjBscInfoQueryCondition();
				prjQC.setCstIdList(cstIdList);
				prjQC.setCstMgrIdList(cstMgrIdList);
				List<PrjBscInfoDTO> prjBscInfoList = this.projectApiService.searchPrjBscInfoList(prjQC);
				if(CollectionUtils.isNotEmpty(prjBscInfoList)){
					List<Long> prjIdList = new ArrayList<Long>();
					for (PrjBscInfoDTO prjBscInfoDTO : prjBscInfoList) {
						prjIdList.add(prjBscInfoDTO.getId());
					}
					qc.setPrjIdList(prjIdList);
				}else{
					return new ListPageVO<AudReturnVisitVO>(new ArrayList<AudReturnVisitVO>(), 0);
				}
			}else{
				return new ListPageVO<AudReturnVisitVO>(new ArrayList<AudReturnVisitVO>(), 0);
			}
		}*/
        if (StringUtils.isNotEmpty(crtStartDt)) {
            qc.setCrtStartDt(DateUtils.formatStringToDate(crtStartDt, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(crtEndDt)) {
            qc.setCrtEndDt(DateUtils.formatStringToDate(crtEndDt, DateUtils.YYYY_MM_DD));
        }
        //承租人、电话号码时，全量查询
        if (StringUtils.isEmpty(cstNm) && StringUtils.isEmpty(phone) && StringUtils.isEmpty(crtStartDt)){
            //先判断
            Calendar instance = Calendar.getInstance();
            instance.setTime(new Date());
            instance.add(Calendar.YEAR, -1);
            instance.add(Calendar.DATE, 1);
            qc.setCrtStartDt(DateUtils.formatDate(instance.getTime(), DateUtils.YYYY_MM_DD));
        }
        qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
        //过滤掉贷后的数据
        qc.setNotDataInitSource("1");
        page.setCondition(qc);

        Pager pager = this.audReturnVisitService.searchListPage(page);
        List<AudReturnVisitVO> list = (List<AudReturnVisitVO>) pager.getResultList();
        ListPageVO<AudReturnVisitVO> listPage = new ListPageVO<AudReturnVisitVO>(list, pager.getTotalCount());
        BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
        return listPage;
    }

    /**
     * 删除数据
     */
    @RequestMapping(value = "/removeById.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            return result;
        }
        try {
            this.audReturnVisitService.removeById(Long.valueOf(id));
            BaseLogUtils.info(logger, "removeById", "删除数据.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "removeById", "删除数据失败.[id=" + id + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "removeById", "删除数据失败.[id=" + id + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }

        return result;
    }

    /**
     * 根据项目ID和流程实例ID获取回访信息
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getByProjectId.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getByProjectId(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String projectId = request.getParameter("projectId");
        //2017-3-22 String proIntId = request.getParameter("proIntId");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if (StringUtils.isEmpty(projectId)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_AUD_PROJECT_ID_NOT_EMPTY + SysLogConstant.LOG_AUD_PROINT_ID_NOT_EMPTY);
            BaseLogUtils.error(logger, "getByProjectId", "获取数据,主键不存在.[projectId=" + projectId + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        try {
            AudReturnVisitVO vo = this.audReturnVisitService.selectByProjectIdAndProIntId(Long.valueOf(projectId));
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
                BaseLogUtils.info(logger, "getByProjectId", "获取数据,数据不存在.[projectId=" + projectId + "]", CurrentThreadContext.getCurrentUserName());
            }
            result.setData(vo);
            BaseLogUtils.info(logger, "getByProjectId", "获取数据.[projectId=" + projectId + "]", CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "getByProjectId", "获取失败.[projectId=" + projectId + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "getByProjectId", "获取失败.[projectId=" + projectId + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/addAudOpeLine.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addAudOpeLine(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        AudReturnVisitVO entity = null;
        try {
            String jsonStr = request.getParameter("parms[jsonStr]"); //(出发地)（目的地）jsonSTR
            String id = request.getParameter("id");//回访id
            if (StringUtils.isBlank(id) == false) {
                JSONArray array = JSON.parseArray(jsonStr);
                List<AudOpeLineVO> list = new ArrayList<AudOpeLineVO>();
                for (Object object : array) {
                    AudOpeLineVO audOpeLineVO = new AudOpeLineVO();
                    JSONObject obj = (JSONObject) object;
                    String rgnPrCd = (String) obj.get("rgnPrCd");//省 (出发地)
                    String rgnCyCd = (String) obj.get("rgnCyCd");//市(出发地)
                    String rgnPrCds = (String) obj.get("rgnPrCds");//省 （目的地）
                    String rgnCyCds = (String) obj.get("rgnCyCds");//市（目的地）
                    String olId = (String) obj.get("olId");//运营路线ID
                    if (StringUtils.isNotBlank(olId)) {
                        audOpeLineVO.setId(Long.valueOf(olId));
                    }
                    if (StringUtils.isNotBlank(rgnCyCd)) {
                        //rgnPrCd=rgnCyCd.substring(0,4);
                        audOpeLineVO.setRgnPrCd(rgnPrCd);//出发省
                    } else {
                        throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "运营路线省不能为空！");
                    }
                    if (StringUtils.isNotBlank(rgnCyCds)) {
                        //rgnPrCds=rgnCyCds.substring(0,4);//目的地省
                        audOpeLineVO.setRgnPrCds(rgnPrCds);
                    } else {
                        throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "运营路线省不能为空！");
                    }
                    if (StringUtils.isNotBlank(rgnCyCd)) {
                        audOpeLineVO.setRgnCyCd(rgnCyCd);//出发市
                    }
                    if (StringUtils.isNotBlank(rgnCyCds)) {//目的地市
                        audOpeLineVO.setRgnCyCds(rgnCyCds);
                    }
                    audOpeLineVO.setCrtTm(new Date());
                    audOpeLineVO.setMdfTm(new Date());
                    audOpeLineVO.setIsDel("0");
                    audOpeLineVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    audOpeLineVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                    audOpeLineVO.setVisitId(Long.valueOf(id));//回访记录表ID
                    list.add(audOpeLineVO);
                }

                if (CollectionUtils.isEmpty(list)) {
                    throw new BaseException(BaseExceptionConstant.COMMON_0001, "新增对象不能为空");
                }
                List<AuditOpeLineDTO> dtoList = new ArrayList<>();
                for (AudOpeLineVO audOpeLineVO : list) {
                    AuditOpeLineDTO auditOpeLineDTO = new AuditOpeLineDTO();
                    BeanUtils.copyProperties(audOpeLineVO, auditOpeLineDTO);
                    if (StringUtils.isNotEmpty(audOpeLineVO.getIsDel())) {
                        auditOpeLineDTO.setIsDel(Integer.valueOf(audOpeLineVO.getIsDel()));
                    }
                    dtoList.add(auditOpeLineDTO);
                }
                BatchAddOperateLineRequest addRequest = new BatchAddOperateLineRequest(dtoList);
                ResponseData responseData = auditOpeLineService.batchAddAudvisitOperateLine(addRequest);
                if (!ResponseData.SUCCESS_CODE.equals(responseData.getCode())) {
                    throw new BaseException(BaseExceptionConstant.DATABASE_0201, "新增数据失败");
                }
            } else {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("保存失败，请先保存基本信息。");
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }


    /**
     * 修改
     */
    @RequestMapping(value = "/updateAudOpeLine.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object updateAudOpeLine(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        AudReturnVisitVO entity = null;
        //int i = 0;
        try {

            String jsonStr = request.getParameter("parms[jsonStr]"); //(出发地)（目的地）jsonSTR
            String id = request.getParameter("id");//回访id

            if (StringUtils.isBlank(id) == false) {
                JSONArray array = JSON.parseArray(jsonStr);
                List<AudOpeLineVO> list = new ArrayList<AudOpeLineVO>();
                for (Object object : array) {
                    AudOpeLineVO audOpeLineVO = new AudOpeLineVO();
                    JSONObject obj = (JSONObject) object;
                    String rgnPrCd = (String) obj.get("rgnPrCd");//省 (出发地)  0027  0010
                    String rgnCyCd = (String) obj.get("rgnCyCd");//市(出发地) 00270019  00100003
                    String rgnPrCds = (String) obj.get("rgnPrCds");//省 （目的地）0013  0002
                    String rgnCyCds = (String) obj.get("rgnCyCds");//市（目的地）  00020018
                    String olId = (String) obj.get("olId");//运营路线ID 00010011
                    if (StringUtils.isNotBlank(olId)) {
                        audOpeLineVO.setId(Long.valueOf(olId));
                    }
                    if (StringUtils.isNotBlank(rgnCyCd)) {
                        //rgnPrCd=rgnCyCd.substring(0,4);
                        audOpeLineVO.setRgnPrCd(rgnPrCd);//出发省
                    } else {
                        throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "运营路线省不能为空！");
                    }
                    if (StringUtils.isNotBlank(rgnCyCds)) {
                        //rgnPrCds=rgnCyCds.substring(0,4);//目的地省
                        audOpeLineVO.setRgnPrCds(rgnPrCds);
                    } else {
                        throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "运营路线省不能为空！");
                    }
                    if (StringUtils.isNotBlank(rgnCyCd)) {
                        audOpeLineVO.setRgnCyCd(rgnCyCd);//出发市
                    }
                    if (StringUtils.isNotBlank(rgnCyCds)) {//目的地市
                        audOpeLineVO.setRgnCyCds(rgnCyCds);
                    }
                    audOpeLineVO.setCrtTm(new Date());
                    audOpeLineVO.setMdfTm(new Date());
                    audOpeLineVO.setIsDel("0");
                    audOpeLineVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    audOpeLineVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                    audOpeLineVO.setVisitId(Long.valueOf(id));//回访记录表ID
                    list.add(audOpeLineVO);
                }

                if (CollectionUtils.isEmpty(list)) {
                    throw new BaseException(BaseExceptionConstant.COMMON_0001, "新增对象不能为空");
                }

                List<AuditOpeLineDTO> dtoList = new ArrayList<>();
                for (AudOpeLineVO audOpeLineVO : list) {
                    AuditOpeLineDTO auditOpeLineDTO = new AuditOpeLineDTO();
                    BeanUtils.copyProperties(audOpeLineVO, auditOpeLineDTO);
                    if (StringUtils.isNotEmpty(audOpeLineVO.getIsDel())) {
                        auditOpeLineDTO.setIsDel(Integer.valueOf(audOpeLineVO.getIsDel()));
                    }
                    dtoList.add(auditOpeLineDTO);
                }
                BatchAddOperateLineRequest addRequest = new BatchAddOperateLineRequest(dtoList);
                ResponseData responseData = auditOpeLineService.batchAddAudvisitOperateLine(addRequest);
                if (!ResponseData.SUCCESS_CODE.equals(responseData.getCode())) {
                    throw new BaseException(BaseExceptionConstant.DATABASE_0201, "新增数据失败");
                }
            } else {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("保存失败，请先保存基本信息。");
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }


    /**
     * 删除 运营路线
     */
    @RequestMapping(value = "/deltableByIds.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object deltableByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        String ids = request.getParameter("ids"); //运营路线ID

        try {
            JSONArray array = JSON.parseArray(ids);
            //运营路线ID
            List<Long> idList = new ArrayList<>();
            for (Object s : array) {
                String obj = (String) s;
                idList.add(Long.valueOf(obj));
            }
            RemoveOperateLineRequest removeRequest = new RemoveOperateLineRequest(idList);
            ResponseData responseData = auditOpeLineService.removeOperateLineByIds(removeRequest);
            if (!ResponseData.SUCCESS_CODE.equals(responseData.getCode())) {
                throw new BaseException(BaseExceptionConstant.DATABASE_0201_NAME, "删除数据失败");
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "deltableByIds", "删除数据.[id=" + ids.toString() + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "deltableByIds", "删除数据.[id=" + ids.toString() + "]" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }

        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/add.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
    	 DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
         AudReturnVisitVO entity = null;
         try {
             String DaiHou = request.getParameter("DaiHou");
             entity = this.getRequestParamForAdd(request);
             Long id = this.audReturnVisitService.add(entity);
             if(StringUtils.isNotEmpty(DaiHou) && "1".equals(DaiHou) && null != entity){
            	 entity.setDataInitSource("1");
             }
             result.setData(id);
             BaseLogUtils.info(logger, "add", "新增数据.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
         } catch (BaseException ex) {
             result.setSuccess(BaseConstant.IS_YESNO_NO);
             result.setInfo(ex.getMessage());
             BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
         } catch (Exception ex) {
             result.setSuccess(BaseConstant.IS_YESNO_NO);
             result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
             BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
         }

         return result;
    }

    /**
     * 新增/修改vo转dto
     */
    private AudReturnVisitDTO auditReturnVisitDTOTransform(AudReturnVisitVO vo) throws BaseException {
        if (vo == null) {
            throw new BaseException(BaseExceptionConstant.DATABASE_0201_NAME, "新增对象不能为空!");
        }
        AudReturnVisitDTO dto = new AudReturnVisitDTO();
        BeanUtils.copyProperties(vo, dto);
        dto.setOptionCfg(vo.getPotionCfg());
        dto.setHandlingMode(vo.getHandingMode());
        dto.setLastAuditorName(vo.getLastAuditorNm());
        dto.setAuditorId(vo.getAuditorId());
        dto.setAuditorName(vo.getAuditorName());

        if (vo.getAudVisitTkVO() != null) {
            AudVisitTkDTO audVisitTkDTO = new AudVisitTkDTO();
            BeanUtils.copyProperties(vo.getAudVisitTkVO(), audVisitTkDTO);
            dto.setAudVisitTkDTO(audVisitTkDTO);
        }

        if (vo.getAudVisitAgriculturalVO() != null) {
            AudVisitAgrDTO audVisitAgrDTO = new AudVisitAgrDTO();
            BeanUtils.copyProperties(vo.getAudVisitAgriculturalVO(), audVisitAgrDTO);
            dto.setAudVisitAgrDTO(audVisitAgrDTO);
        }

        if (vo.getAudVisitCarVO() != null) {
            AudVisitCarDTO audVisitCarDTO = new AudVisitCarDTO();
            BeanUtils.copyProperties(vo.getAudVisitCarVO(), audVisitCarDTO);
            dto.setAudVisitCarDTO(audVisitCarDTO);
        }

        List<AudVisitRecordVO> audVisitRecordVOList = vo.getAudVisitRecordVOList();
        if (CollectionUtils.isNotEmpty(audVisitRecordVOList)) {
            List<AudVisitRecordDTO> audVisitRecordDTOList = new ArrayList<>();
            for (AudVisitRecordVO audVisitRecordVO : audVisitRecordVOList) {
            	AudVisitRecordDTO audVisitRecordDTO = new AudVisitRecordDTO();
                BeanUtils.copyProperties(audVisitRecordVO, audVisitRecordDTO);
                audVisitRecordDTO.setAccountManagerName(audVisitRecordVO.getAccountManagerNm());
                audVisitRecordDTO.setAuditorName(audVisitRecordVO.getAuditorNm());
                audVisitRecordDTO.setLastAuditorName(audVisitRecordVO.getLastAuditorNm());
                audVisitRecordDTOList.add(audVisitRecordDTO);
            }
            dto.setAudVisitRecordDTOList(audVisitRecordDTOList);
        }
        return dto;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/modify.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
    	 String id = request.getParameter("id");
         DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
         if (StringUtils.isEmpty(id)) {
             result.setSuccess(BaseConstant.IS_YESNO_NO);
             result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
             BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
             return result;
         }
         AudReturnVisitVO entity = null;
         try {
             entity = this.getRequestParamForModify(request);
             entity.setId(Long.valueOf(id));
             AudCreditInfoVO audCreditInfoVO = entity.getAudCreditInfoVO();
             if (null != audCreditInfoVO) {
                 audCreditInfoVO.setProjectId(Long.valueOf(id));
                 entity.setAudCreditInfoVO(audCreditInfoVO);

             }
             AudVisitAgriculturalVO audVisitAgriculturalVO = entity.getAudVisitAgriculturalVO();
             if (null != audVisitAgriculturalVO) {
                 audVisitAgriculturalVO.setVisitId(Long.valueOf(id));
                 entity.setAudVisitAgriculturalVO(audVisitAgriculturalVO);
             }
             AudVisitCarVO audVisitCarVO = entity.getAudVisitCarVO();
             if (null != audVisitCarVO) {
                 audVisitCarVO.setVisitId(Long.valueOf(id));
                 entity.setAudVisitCarVO(audVisitCarVO);
             }
             List<AudVisitRecordVO> audVisitRecordVOList = entity.getAudVisitRecordVOList();
             if (CollectionUtils.isNotEmpty(audVisitRecordVOList)) {
                 for (AudVisitRecordVO audVisitRecordVO : audVisitRecordVOList) {
                     audVisitRecordVO.setVisitId(Long.valueOf(id));
                 }
                 entity.setAudVisitRecordVOList(audVisitRecordVOList);
             }
             boolean success = this.audReturnVisitService.modify(entity);
             if (!success) {
                 result.setSuccess(BaseConstant.IS_YESNO_NO);
                 result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
                 BaseLogUtils.info(logger, "modify", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
             }
         } catch (BaseException ex) {
             result.setSuccess(BaseConstant.IS_YESNO_NO);
             result.setInfo(ex.getMessage());
             BaseLogUtils.info(logger, "modify", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
         } catch (Exception ex) {
             result.setSuccess(BaseConstant.IS_YESNO_NO);
             result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
             BaseLogUtils.newLogger("修改回访基本信息异常:param:{}",JSONObject.toJSONString(entity)).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
             BaseLogUtils.error(logger, "modify", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
         }
         return result;
    }
    //********************私有方法********************//

    /**
     * 获取参数信息
     *
     * @param request
     * @return
     * @throws BaseException
     */
    private AudReturnVisitVO getRequestParam(HttpServletRequest request) throws BaseException {
        AudReturnVisitVO audReturnVisitVO = new AudReturnVisitVO();
        String projectId = request.getParameter("projectId");
        String proIntId = request.getParameter("proIntId");
        if (StringUtils.isNotEmpty(projectId)) {
            audReturnVisitVO.setProjectId(Long.valueOf(projectId));
        }
        audReturnVisitVO.setProIntId(proIntId);

        /**承租人回访记录*/
        String visitTypeCd = AudStandingBookConstant.AUD_VISIT_TYP_CD_TEN;//回访类型-承租人回访
        String personnelTypeCd = AudStandingBookConstant.AUD_PER_TYP_CD_TEN;//回访人员类型-承租人
        String personnelName = request.getParameter("personnelName");//回访人员姓名
        String accountManagerId = request.getParameter("accountManagerId");//客户经理ID
        String accountManagerNm = request.getParameter("accountManagerNm");//客户经理NM
        String auditorId = request.getParameter("auditorId");//信审员ID
        String auditorNm = request.getParameter("auditorNm");//信审员NM
        String visitTm = request.getParameter("visitTm");//回访时间
        String phone = request.getParameter("phone");//回访电话
        String isSelfAnswer = request.getParameter("isSelfAnswer");//是否本人接听
        String representativeName = request.getParameter("representativeName");//代访人姓名
        String representativePhone = request.getParameter("representativePhone");//代访人电话
        String relationshipCd = request.getParameter("relationshipCd");//代访人与承租人关系
        String identityCd = request.getParameter("identityCd");//身份信息
        String addressCd = request.getParameter("addressCd");//家庭住址
        String address = request.getParameter("address");//另述地址
        String DaiHou = request.getParameter("DaiHou");//贷后信审标识
        String returnVisitId = request.getParameter("returnVisitId");//信审员ID
        String returnVisitNm = request.getParameter("returnVisitNm");//信审员NM
        List<AudVisitRecordVO> audVisitRecordVOList = new ArrayList<AudVisitRecordVO>();
        AudVisitRecordVO audVisitRecordVO = new AudVisitRecordVO();

        audVisitRecordVO.setVisitTypeCd(visitTypeCd);
        audVisitRecordVO.setPersonnelTypeCd(personnelTypeCd);
        audVisitRecordVO.setPersonnelName(personnelName);
        if (StringUtils.isNotEmpty(accountManagerId)) {
            audVisitRecordVO.setAccountManagerId(Long.valueOf(accountManagerId));
        }
        audVisitRecordVO.setAccountManagerNm(accountManagerNm);
        if (StringUtils.isNotEmpty(auditorId)) {
            audVisitRecordVO.setAuditorId(Long.valueOf(auditorId));
        }
        audVisitRecordVO.setAuditorNm(auditorNm);
        if (StringUtils.isNotEmpty(visitTm)) {
            audVisitRecordVO.setVisitTm(DateUtils.formatStringToDate(visitTm, DateUtils.YYYY_MM_DD));
        }


        audVisitRecordVO.setPhone(phone);
        if (StringUtils.isNotEmpty(isSelfAnswer)) {
            audVisitRecordVO.setIsSelfAnswer(Integer.valueOf(isSelfAnswer));
        }
        audVisitRecordVO.setRepresentativeName(representativeName);
        audVisitRecordVO.setRepresentativePhone(representativePhone);
        audVisitRecordVO.setRelationshipCd(relationshipCd);
        audVisitRecordVO.setIdentityCd(identityCd);
        audVisitRecordVO.setAddressCd(addressCd);
        audVisitRecordVO.setAddress(address);
        audVisitRecordVOList.add(audVisitRecordVO);
        audReturnVisitVO.setAudVisitRecordVOList(audVisitRecordVOList);
        //新增加的车辆运营的字段
        String circuitType = request.getParameter("circuitType");//线路类型
        String cargoWeigth = request.getParameter("cargoWeigth");//货物重量
        String cargoVomule = request.getParameter("cargoVomule");//货物体积
        String handingMode = request.getParameter("handingMode");//装卸方式
        String circuitEfficiency = request.getParameter("circuitEfficiency");//线路月效率
        String fare = request.getParameter("fare");//单趟运价
        audReturnVisitVO.setCircuitType(circuitType);
        audReturnVisitVO.setCargoWeigth(cargoWeigth);
        audReturnVisitVO.setCargoVomule(cargoVomule);
        audReturnVisitVO.setHandingMode(handingMode);
        audReturnVisitVO.setCircuitEfficiency(circuitEfficiency);
        audReturnVisitVO.setFare(fare);
        String highSpeedDemandCd = request.getParameter("highSpeedDemandCd");//购买车辆是否有上高速需求
        String introduceEtcCd = request.getParameter("introduceEtcCd");//客户经理是否主动向客户介绍ETC
        String signEtcContCd = request.getParameter("signEtcContCd");//客户是否签署《ETC办理授权委托书及业务告知单》
        audReturnVisitVO.setHighSpeedDemandCd(highSpeedDemandCd);
        audReturnVisitVO.setIntroduceEtcCd(introduceEtcCd);
        audReturnVisitVO.setSignEtcContCd(signEtcContCd);
        String visitStatus = "1";
		/*AudCreditInfoVO audCreditInfoVO = new AudCreditInfoVO();
		audCreditInfoVO.setVisitStatus(visitStatus);
		audReturnVisitVO.setAudCreditInfoVO(audCreditInfoVO);*/
        audReturnVisitVO.setVisitStatus(visitStatus);
        audReturnVisitVO.setLastVisitTm(new Date());
		/* if(StringUtils.isNotEmpty(visitTm)){//贷后回访时间
			 audReturnVisitVO.setLastVisitTm(DateUtils.formatStringToDate(visitTm, DateUtils.YYYY_MM_DD));
	   		}*/
        Long auditorIdL= null;
        if(StringUtils.isNotEmpty(auditorId)){
        	auditorIdL = Long.valueOf(auditorId);
        }
        if (StringUtils.isNotBlank(DaiHou)) {
            if (DaiHou.equals("1")) {
                audReturnVisitVO.setLastAuditorId(auditorIdL);
                audReturnVisitVO.setLastAuditorNm(auditorNm);//贷后信审员
            }
        } else {
            audReturnVisitVO.setAuditorName(auditorNm);//信审员
            audReturnVisitVO.setAuditorId(Long.valueOf(auditorId));
        }

        audReturnVisitVO.setReturnVisitId(returnVisitId);
        audReturnVisitVO.setReturnVisitNm(returnVisitNm);

        /**车辆确认*/
        String times = request.getParameter("times");//融资次数
        String equipmentNum = request.getParameter("equipmentNum");//设备数量
        String motorHorsepower = request.getParameter("motorHorsepower");//发动机马力
        String containerSize = request.getParameter("containerSize");//货箱规格
        String isExistTrunc = request.getParameter("isExistTrunc");//是否含挂车
        String truncStandard = request.getParameter("truncStandard");//挂车规格
        String truncConfig = request.getParameter("truncConfig");//挂车配置
        String emissionStandard = request.getParameter("emissionStandard");//排放/排量
        String gearbox = request.getParameter("gearbox");//变速箱
        String carBrandCd = request.getParameter("carBrandCd");//品牌及车型
        String equipmentName = request.getParameter("equipmentName");//车辆设备名
        String yeayAmt = request.getParameter("yeayAmt");//年款
        String usefulLife = request.getParameter("usefulLife");//使用年限
        String mileage = request.getParameter("mileage");//里程数
        String otherConfig = request.getParameter("otherConfig");//其他配置
        String seating = request.getParameter("seating");//座位数
        String busLen = request.getParameter("busLen");//车身长度
        String braking = request.getParameter("braking");//制动方式
        String powerCd = request.getParameter("powerCd");//动力方式
        String potionCfg = request.getParameter("potionCfg");//选装配置
        String holdSpace = request.getParameter("holdSpace");//载货空间
        String batDeg = request.getParameter("batDeg");//电池度数
        String endMileage = request.getParameter("endMileage");//续航里程
        audReturnVisitVO.setTimes(times);
        audReturnVisitVO.setEquipmentNum(equipmentNum);
        audReturnVisitVO.setMotorHorsepower(motorHorsepower);
        audReturnVisitVO.setContainerSize(containerSize);
        if (StringUtils.isNotEmpty(isExistTrunc)) {
            audReturnVisitVO.setIsExistTrunc(Integer.valueOf(isExistTrunc));
        }
        audReturnVisitVO.setTruncStandard(truncStandard);
        audReturnVisitVO.setTruncConfig(truncConfig);
        audReturnVisitVO.setEmissionStandard(emissionStandard);
        audReturnVisitVO.setGearbox(gearbox);
        audReturnVisitVO.setCarBrandCd(carBrandCd);
        audReturnVisitVO.setEquipmentName(equipmentName);
        if (StringUtils.isNotEmpty(yeayAmt)) {
            audReturnVisitVO.setYeayAmt(DecimalUtils.mul(Double.valueOf(yeayAmt), 100));
        }
        audReturnVisitVO.setUsefulLife(usefulLife);
        audReturnVisitVO.setMileage(mileage);
        audReturnVisitVO.setOtherConfig(otherConfig);
        if (StringUtils.isNotEmpty(seating)) {
            audReturnVisitVO.setSeating(Long.valueOf(seating));
        }
        audReturnVisitVO.setBusLen(busLen);
        audReturnVisitVO.setBraking(braking);
        audReturnVisitVO.setPowerCd(powerCd);
        audReturnVisitVO.setPotionCfg(potionCfg);

        if (StringUtils.isNotEmpty(holdSpace)) {
            audReturnVisitVO.setHoldSpace(Double.valueOf(holdSpace));
        }
        if (StringUtils.isNotEmpty(batDeg)) {
            audReturnVisitVO.setBatDeg(Double.valueOf(batDeg));
        }
        if (StringUtils.isNotEmpty(endMileage)) {
            audReturnVisitVO.setEndMileage(Double.valueOf(endMileage));
        }

        /**融资方案确认*/
        String mainMarketPrice = request.getParameter("mainMarketPrice");//主车价格
        String pickCardCd = request.getParameter("pickCardCd");//提车情况
        String statusCd = request.getParameter("statusCd");//上牌情况
        String cardDate = request.getParameter("cardDate");//上牌时间
        String itemPay = request.getParameter("itemPay");//款项缴纳情况
        String leaseTerm = request.getParameter("leaseTerm");//融资期限
        String truncMarketPrice = request.getParameter("truncMarketPrice");//挂车价格
        String monthRepayment = request.getParameter("monthRepayment");//月还款
        String agentCardStateCd = request.getParameter("agentCardStateCd");//代扣卡
        String eqmtAddressCd = request.getParameter("eqmtAddressCd");//设备位置
        String vehiclesDoorCd = request.getParameter("vehiclesDoorCd");//车辆上户
        String affiliatedCompany = request.getParameter("affiliatedCompany");//挂靠公司名称
        String subsidyAmt = request.getParameter("subsidyAmt");//补贴款金额
        String pickCardTm = request.getParameter("pickCardTm");//提车时间
        String dealerAmt = request.getParameter("dealerAmt");//经销商垫款金额
        String firstPayPct = request.getParameter("firstPayPct");//首付比例
        String financingAmt = request.getParameter("financingAmt");//融资金额
        String smallRepaymentAmt = request.getParameter("smallRepaymentAmt");//小额还款金额
        String largeRepaymentAmt = request.getParameter("largeRepaymentAmt");//大额还款金额
        audReturnVisitVO.setMainMarketPrice(mainMarketPrice);
        audReturnVisitVO.setPickCardCd(pickCardCd);
        audReturnVisitVO.setStatusCd(statusCd);
        audReturnVisitVO.setCardDate(cardDate);
        audReturnVisitVO.setItemPay(itemPay);
        audReturnVisitVO.setLeaseTerm(leaseTerm);
        audReturnVisitVO.setTruncMarketPrice(truncMarketPrice);
        audReturnVisitVO.setMonthRepayment(monthRepayment);
        audReturnVisitVO.setAgentCardStateCd(agentCardStateCd);
        audReturnVisitVO.setEqmtAddressCd(eqmtAddressCd);
        audReturnVisitVO.setVehiclesDoorCd(vehiclesDoorCd);
        audReturnVisitVO.setAffiliatedCompany(affiliatedCompany);
        if (StringUtils.isNotEmpty(subsidyAmt)) {
            audReturnVisitVO.setSubsidyAmt(DecimalUtils.mul(Double.valueOf(subsidyAmt), 100));
        }
        if (StringUtils.isNotEmpty(pickCardTm)) {
            audReturnVisitVO.setPickCardTm(DateUtils.formatStringToDate(pickCardTm, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(dealerAmt)) {
            audReturnVisitVO.setDealerAmt(DecimalUtils.mul(Double.valueOf(dealerAmt), 100));
        }
        if (StringUtils.isNotEmpty(financingAmt)) {
            audReturnVisitVO.setFirstPayPct(Double.valueOf(firstPayPct));
        }
        if (StringUtils.isNotEmpty(financingAmt)) {
            audReturnVisitVO.setFinancingAmt(DecimalUtils.mul(Double.valueOf(financingAmt), 100));
        }
        if (StringUtils.isNotEmpty(smallRepaymentAmt)) {
            audReturnVisitVO.setSmallRepaymentAmt(DecimalUtils.mul(Double.valueOf(smallRepaymentAmt), 100));
        }
        if (StringUtils.isNotEmpty(largeRepaymentAmt)) {
            audReturnVisitVO.setLargeRepaymentAmt(DecimalUtils.mul(Double.valueOf(largeRepaymentAmt), 100));
        }

        /**提供保障信息*/
        String guraRl = request.getParameter("guraRl");
        String guraRem = request.getParameter("guraRem");
        String ugRl = request.getParameter("ugRl");
        String ugRem = request.getParameter("ugRem");
        audReturnVisitVO.setGuraRl(guraRl);
        audReturnVisitVO.setGuraRem(guraRem);
        audReturnVisitVO.setUgRl(ugRl);
        audReturnVisitVO.setUgRem(ugRem);

        /**卡车增加*/
        String profitCd = request.getParameter("profitCd");//盈利方式
        String cmpDesc = request.getParameter("cmpDesc");//主营公司介绍
        String biz = request.getParameter("biz");//经营
        String bizExp = request.getParameter("bizExp");//经营经验
        String selfTkDesc = request.getParameter("selfTkDesc");//自有车辆情况/运输经验
        String tkUseDesc = request.getParameter("tkUseDesc");//车辆用途
        String transRange = request.getParameter("transRange");//运输范围
        String income = request.getParameter("income");//收入情况
        String goods = request.getParameter("goods");//主运输货物
        String route = request.getParameter("route");//运营路线
        String toGdsRes = request.getParameter("toGdsRes");//去程货物来源
        String toGds = request.getParameter("toGds");//去程货物
        String toStlWay = request.getParameter("toStlWay");//去程计费及结算方式
        String cmGdsRes = request.getParameter("cmGdsRes");//返程货物来源
        String cmGds = request.getParameter("cmGds");//返程货物
        String cmStlWay = request.getParameter("cmStlWay");//返程计费及结算方式
        String driver = request.getParameter("driver");//驾驶员
        String transTms = request.getParameter("transTms");//运输趟数
        String transFee = request.getParameter("transFee");//费用
        String purInc = request.getParameter("purInc");//月净收入
        String otherInfo = request.getParameter("otherInfo");//其他信息
        String mainGdsTypCd = request.getParameter("mainGdsTypCd");//主货物大类
        String goodsRes = request.getParameter("goodsRes");//货物来源
        String gdsStlWayCd = request.getParameter("gdsStlWayCd");//主货物结算方式
        String secondPayResCd = request.getParameter("secondPayResCd");//第二还款来源

        //专车客车
        String netIncome = request.getParameter("netIncome");//净收入
        String highEasonCharterdBus = request.getParameter("highEasonCharterdBus");//旺季包车费
        String peakEasonCharterdBus = request.getParameter("peakEasonCharterdBus");//淡季包车费
        String otherFeePct = request.getParameter("otherFeePct");//其他费用占比
        String grossIncome = request.getParameter("grossIncome");//毛收入
        AudVisitTkVO audVisitTkVO = new AudVisitTkVO();
        audVisitTkVO.setProfitCd(profitCd);
        audVisitTkVO.setCmpDesc(cmpDesc);
        audVisitTkVO.setBiz(biz);
        audVisitTkVO.setBizExp(bizExp);
        audVisitTkVO.setSelfTkDesc(selfTkDesc);
        audVisitTkVO.setTkUseDesc(tkUseDesc);
        audVisitTkVO.setTransRange(transRange);
        audVisitTkVO.setIncome(income);
        audVisitTkVO.setGoods(goods);
        audVisitTkVO.setRoute(route);
        audVisitTkVO.setToGdsRes(toGdsRes);
        audVisitTkVO.setToGds(toGds);
        audVisitTkVO.setToStlWay(toStlWay);
        audVisitTkVO.setCmGds(cmGds);
        audVisitTkVO.setCmGdsRes(cmGdsRes);
        audVisitTkVO.setCmStlWay(cmStlWay);
        audVisitTkVO.setDriver(driver);
        audVisitTkVO.setTransTms(transTms);
        audVisitTkVO.setTransFee(transFee);
        audVisitTkVO.setPurInc(purInc);
        audVisitTkVO.setOtherInfo(otherInfo);
        audVisitTkVO.setMainGdsTypCd(mainGdsTypCd);
        audVisitTkVO.setGoodsRes(goodsRes);
        audVisitTkVO.setGdsStlWayCd(gdsStlWayCd);
        audVisitTkVO.setSecondPayResCd(secondPayResCd);
        if (StringUtils.isNotEmpty(grossIncome)) {
            audVisitTkVO.setGrossIncome(DecimalUtils.convertYuanToFen(Double.valueOf(grossIncome)));
        }
        if (StringUtils.isNotEmpty(highEasonCharterdBus)) {
            audVisitTkVO.setHighEasonCharterdBus(DecimalUtils.convertYuanToFen(Double.valueOf(highEasonCharterdBus)));
        }
        if (StringUtils.isNotEmpty(peakEasonCharterdBus)) {
            audVisitTkVO.setPeakEasonCharterdBus(DecimalUtils.convertYuanToFen(Double.valueOf(peakEasonCharterdBus)));
        }
        if (StringUtils.isNotEmpty(otherFeePct)) {
            audVisitTkVO.setOtherFeePct(Double.valueOf(otherFeePct));
        }
        if (StringUtils.isNotEmpty(netIncome)) {
            audVisitTkVO.setNetIncome(DecimalUtils.convertYuanToFen(Double.valueOf(netIncome)));
        }
        audReturnVisitVO.setAudVisitTkVO(audVisitTkVO);


        /**农机增加*/
		/*String yearNetAmt = request.getParameter("yearNetAmt");//承租人年净收入
		String loanPrjAmt = request.getParameter("loanPrjAmt");//贷款项目及金额
		String yearCostAmt = request.getParameter("yearCostAmt");//年日常生活开销
		String yearDominateAmt = request.getParameter("yearDominateAmt");//年可支配资金
		String isPress = request.getParameter("isPress");//大额还款是否有压力
		if(StringUtils.isNotEmpty(yearNetAmt)){
			audReturnVisitVO.setYearNetAmt(DecimalUtils.mul(Double.valueOf(yearNetAmt), 100));
		}
		audReturnVisitVO.setLoanPrjAmt(loanPrjAmt);
		if(StringUtils.isNotEmpty(yearCostAmt)){
			audReturnVisitVO.setYearCostAmt(DecimalUtils.mul(Double.valueOf(yearCostAmt), 100));
		}
		if(StringUtils.isNotEmpty(yearDominateAmt)){
			audReturnVisitVO.setYearDominateAmt(DecimalUtils.mul(Double.valueOf(yearDominateAmt), 100));
		}
		if(StringUtils.isNotEmpty(isPress)){
			audReturnVisitVO.setIsPress(Integer.valueOf(isPress));
		}
		String profitCd = request.getParameter("profitCd");//盈利方式
		String experience = request.getParameter("experience");//自有车辆及运营经验
		String workType = request.getParameter("workType");//作业类型
		String workArea = request.getParameter("workArea");//作业区域
		String workTime = request.getParameter("workTime");//作业期
		String settlement = request.getParameter("settlement");//计费及结算方式
		String netIncome = request.getParameter("netIncome");//净收入
		String otherSourcesIncome = request.getParameter("otherSourcesIncome");//其他收入来源
		String newWorkType = request.getParameter("newWorkType");//新购设备作业类型
		String newWorkArea = request.getParameter("newWorkArea");//新购设备作业区域
		String newWorkTime = request.getParameter("newWorkTime");//新购设备作业区期
		String newSettlement = request.getParameter("newSettlement");//新购设备计费及结算方式
		String driverInfo = request.getParameter("driverInfo");//司机情况
		String sumIncome = request.getParameter("sumIncome");//总净收入
		String ownLand = request.getParameter("ownLand");//自有耕地
		String contractLand = request.getParameter("contractLand");//承包耕地
		String contractPrice = request.getParameter("contractPrice");//地租单价
		String growCrops = request.getParameter("growCrops");//种植作物
		String growthPeriod = request.getParameter("growthPeriod");//生长周期
		String yield = request.getParameter("yield");//亩产
		String salePrice = request.getParameter("salePrice");//单价
		String perMuGrossAmt = request.getParameter("perMuGrossAmt");//每亩毛收入
		String perMuInvestmentAmt = request.getParameter("perMuInvestmentAmt");//每亩投入
		String pemMuNetAmt = request.getParameter("pemMuNetAmt");//每亩净收入
		String settlementPeriod = request.getParameter("settlementPeriod");//结算周期
		String netIncome2 = request.getParameter("netIncome2");//种植净收入
		if(null!=profitCd){
			AudVisitAgriculturalVO audVisitAgriculturalVO = new AudVisitAgriculturalVO();
			audVisitAgriculturalVO.setProfitCd(profitCd);
			audVisitAgriculturalVO.setExperience(experience);
			audVisitAgriculturalVO.setWorkType(workType);
			audVisitAgriculturalVO.setWorkArea(workArea);
			if(StringUtils.isNotEmpty(workTime)){
				audVisitAgriculturalVO.setWorkTime(DateUtils.formatStringToDate(workTime, DateUtils.YYYY_MM_DD));
			}
			audVisitAgriculturalVO.setSettlement(settlement);
			if(StringUtils.isNotEmpty(netIncome)){
				audVisitAgriculturalVO.setNetIncome(DecimalUtils.mul(Double.valueOf(netIncome), 100));
			}
			audVisitAgriculturalVO.setOtherSourcesIncome(otherSourcesIncome);
			audVisitAgriculturalVO.setNewWorkType(newWorkType);
			audVisitAgriculturalVO.setNewWorkArea(newWorkArea);
			audVisitAgriculturalVO.setNewWorkTime(DateUtils.formatStringToDate(newWorkTime, DateUtils.YYYY_MM_DD));
			audVisitAgriculturalVO.setNewSettlement(newSettlement);
			audVisitAgriculturalVO.setDriverInfo(driverInfo);
			if(StringUtils.isNotEmpty(sumIncome)){
				audVisitAgriculturalVO.setSumIncome(DecimalUtils.mul(Double.valueOf(sumIncome), 100));
			}
			audVisitAgriculturalVO.setOwnLand(ownLand);
			audVisitAgriculturalVO.setContractLand(contractLand);
			if(StringUtils.isNotEmpty(contractPrice)){
				audVisitAgriculturalVO.setContractPrice(DecimalUtils.mul(Double.valueOf(contractPrice), 100));
			}
			audVisitAgriculturalVO.setGrowCrops(growCrops);
			audVisitAgriculturalVO.setGrowthPeriod(growthPeriod);
			if(StringUtils.isNotEmpty(yield)){
				audVisitAgriculturalVO.setYield(Long.valueOf(yield));
			}
			if(StringUtils.isNotEmpty(salePrice)){
				audVisitAgriculturalVO.setSalePrice(DecimalUtils.mul(Double.valueOf(salePrice), 100));
			}
			if(StringUtils.isNotEmpty(perMuGrossAmt)){
				audVisitAgriculturalVO.setPerMuGrossAmt(DecimalUtils.mul(Double.valueOf(perMuGrossAmt), 100));
			}
			if(StringUtils.isNotEmpty(perMuInvestmentAmt)){
				audVisitAgriculturalVO.setPerMuInvestmentAmt(DecimalUtils.mul(Double.valueOf(perMuInvestmentAmt), 100));
			}
			if(StringUtils.isNotEmpty(pemMuNetAmt)){
				audVisitAgriculturalVO.setPemMuNetAmt(DecimalUtils.mul(Double.valueOf(pemMuNetAmt), 100));
			}
			audVisitAgriculturalVO.setSettlementPeriod(settlementPeriod);
			if(StringUtils.isNotEmpty(netIncome2)){
				audVisitAgriculturalVO.setNetIncome2(DecimalUtils.mul(Double.valueOf(netIncome2), 100));
			}
			audReturnVisitVO.setAudVisitAgriculturalVO(audVisitAgriculturalVO);
		}*/


        /**乘用车增加*/
        String workTypeCd = request.getParameter("workTypeCd");//工作方式
        String companyName = request.getParameter("companyName");//单位名称
        String companyAddressCd = request.getParameter("companyAddressCd");//单位地址
        String workYeays = request.getParameter("workYeays");//工作年限
        String postCd = request.getParameter("postCd");//职务
        String work = request.getParameter("work");//工作内容
        String monthIncome = request.getParameter("monthIncome");//月收入
        String salaryWayCd = request.getParameter("salaryWayCd");//工资发放方式
        String isSocialSecurity = request.getParameter("isSocialSecurity");//是否缴纳社保
        String carUse = request.getParameter("carUse");//车辆用途
        String downPaymentCd = request.getParameter("downPaymentCd");//首付款来源
        String secondRepayment = request.getParameter("secondRepayment");//第二还款来源
        String otherDebt = request.getParameter("otherDebt");//其他负债
        String spouseInfo = request.getParameter("spouseInfo");//配偶情况
        String otherInfo1 = request.getParameter("otherInfo");//其他信息
        String companyDesc = request.getParameter("companyDesc");//主营公司介绍
        String business = request.getParameter("business");//经营项目
        String operatingPeriod = request.getParameter("operatingPeriod");//经营期限
        String companyIncome = request.getParameter("companyIncome");//公司收入情况
        String sourceIncome = request.getParameter("sourceIncome");//收入来源
        if (null != workTypeCd) {
            AudVisitCarVO audVisitCarVO = new AudVisitCarVO();
            audVisitCarVO.setWorkTypeCd(workTypeCd);
            audVisitCarVO.setCompanyName(companyName);
            audVisitCarVO.setCompanyAddressCd(companyAddressCd);
            audVisitCarVO.setWorkYeays(workYeays);
            audVisitCarVO.setPostCd(postCd);
            audVisitCarVO.setWork(work);
            if (StringUtils.isNotEmpty(monthIncome)) {
                audVisitCarVO.setMonthIncome(DecimalUtils.mul(Double.valueOf(monthIncome), 100));
            }
            audVisitCarVO.setSalaryWayCd(salaryWayCd);
            if (StringUtils.isNotEmpty(isSocialSecurity)) {
                audVisitCarVO.setIsSocialSecurity(Integer.valueOf(isSocialSecurity));
            }
            audVisitCarVO.setCarUse(carUse);
            audVisitCarVO.setDownPaymentCd(downPaymentCd);
            audVisitCarVO.setSecondRepayment(secondRepayment);
            audVisitCarVO.setOtherDebt(otherDebt);
            audVisitCarVO.setSpouseInfo(spouseInfo);
            audVisitCarVO.setOtherInfo(otherInfo1);
            audVisitCarVO.setCompanyDesc(companyDesc);
            audVisitCarVO.setBusiness(business);
            audVisitCarVO.setOperatingPeriod(operatingPeriod);
            audVisitCarVO.setCompanyIncome(companyIncome);
            audVisitCarVO.setSourceIncome(sourceIncome);
            audReturnVisitVO.setAudVisitCarVO(audVisitCarVO);
        }

        return audReturnVisitVO;
    }

    /**
     * 获取请求参数(新增)
     *
     * @param request 请求
     * @return
     */
    private AudReturnVisitVO getRequestParamForAdd(HttpServletRequest request) throws BaseException {
        AudReturnVisitVO audReturnVisitVO = this.getRequestParam(request);
        String DaiHou = request.getParameter("DaiHou");
        audReturnVisitVO.setCrtTm(new Date());
        audReturnVisitVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        AudVisitAgriculturalVO audVisitAgriculturalVO = audReturnVisitVO.getAudVisitAgriculturalVO();
        if (null != audVisitAgriculturalVO) {
            audVisitAgriculturalVO.setCrtTm(new Date());
            audVisitAgriculturalVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            audReturnVisitVO.setAudVisitAgriculturalVO(audVisitAgriculturalVO);
        }
        AudVisitCarVO audVisitCarVO = audReturnVisitVO.getAudVisitCarVO();
        if (null != audVisitCarVO) {
            audVisitCarVO.setCrtTm(new Date());
            audVisitCarVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            audReturnVisitVO.setAudVisitCarVO(audVisitCarVO);
        }
        List<AudVisitRecordVO> audVisitRecordVOList = audReturnVisitVO.getAudVisitRecordVOList();
        if (CollectionUtils.isNotEmpty(audVisitRecordVOList)) {
            for (AudVisitRecordVO audVisitRecordVO : audVisitRecordVOList) {
                audVisitRecordVO.setCrtTm(new Date());
                audVisitRecordVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            }
            audReturnVisitVO.setAudVisitRecordVOList(audVisitRecordVOList);
        }
        return audReturnVisitVO;
    }

    /**
     * 获取请求参数(修改)
     *
     * @param request 请求
     * @return
     */
    private AudReturnVisitVO getRequestParamForModify(HttpServletRequest request) throws BaseException {
        AudReturnVisitVO audReturnVisitVO = this.getRequestParam(request);
        audReturnVisitVO.setMdfTm(new Date());
        audReturnVisitVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
        AudVisitAgriculturalVO audVisitAgriculturalVO = audReturnVisitVO.getAudVisitAgriculturalVO();
        if (null != audVisitAgriculturalVO) {
            audVisitAgriculturalVO.setMdfTm(new Date());
            audVisitAgriculturalVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            audReturnVisitVO.setAudVisitAgriculturalVO(audVisitAgriculturalVO);
        }
        AudVisitCarVO audVisitCarVO = audReturnVisitVO.getAudVisitCarVO();
        if (null != audVisitCarVO) {
            audVisitCarVO.setMdfTm(new Date());
            audVisitCarVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            audReturnVisitVO.setAudVisitCarVO(audVisitCarVO);
        }
        List<AudVisitRecordVO> audVisitRecordVOList = audReturnVisitVO.getAudVisitRecordVOList();
        if (CollectionUtils.isNotEmpty(audVisitRecordVOList)) {
            for (AudVisitRecordVO audVisitRecordVO : audVisitRecordVOList) {
                audVisitRecordVO.setMdfTm(new Date());
                audVisitRecordVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            }
            audReturnVisitVO.setAudVisitRecordVOList(audVisitRecordVOList);
        }
        return audReturnVisitVO;
    }


    /**
     * 到新增/修改页面-回访信息(客户小贷授信记录)
     */
    @RequestMapping(value = "/toAddmcrCstCreditRecPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddmcrCstCreditRecPage(HttpServletRequest request, HttpServletResponse response) {
        String projectId = request.getParameter("projectId");//项目ID
        String carId = request.getParameter("carId");//车辆ID
        String usrId = request.getParameter("usrId");//用户ID
        String isDetail = request.getParameter("isDetail");//是否详情标识(1:详情页面不可编辑,操作按钮隐藏)
        ModelAndView view = new ModelAndView("audit/audReturnVisit/audReturnVisitRecAdd");
        try {

            view.addObject("carId",carId);
            view.addObject("projectId",projectId);
            view.addObject("usrId", usrId);
            view.addObject("isDetail", isDetail);

            //查询当前登录人
            view.addObject("userId", CurrentThreadContext.getCurrentUserId());
            view.addObject("userNm", CurrentThreadContext.getCurrentUserName());
            view.addObject("currentDate", DateUtils.formatDateToString(new Date(),DateUtils.YYYY_MM_DDHHMMSS));

            // 查询用户信息
            String SysCd = PropertiesUtils.getProperty(SystemConstant.FL_SERVICE_CD);
            String OrgCd = PropertiesUtils.getProperty(SystemConstant.FL_ORG_CD);
            SysUsrDTO sysUsrDTO = this.sysUsrApiService.selectSysUsrById(Long.valueOf(usrId), SysCd, OrgCd);
            if (null != sysUsrDTO){
                view.addObject("proposerName", sysUsrDTO.getRefRlNm());
                view.addObject("proposerCertNo", sysUsrDTO.getRefCertNo());
                view.addObject("usrMp", sysUsrDTO.getMp());
            }

            //主货物大类
            List<KeyValueVO> mainGdsTypCdList = this.audCreditInfoService.searchGoodsTypListByLvl("1");
            view.addObject("mainGdsTypCdList", mainGdsTypCdList);

            /**
             * 预览担保人备注--信审员
             */
            List<KeyValueVO> auditUsrKVList = new ArrayList<>();
            McrVisitProposerQC mcrVisitProposerQC = new McrVisitProposerQC();
            mcrVisitProposerQC.setProjectId(Long.valueOf(projectId));
            List<McrVisitProposerDTO> visitProposer = this.mcrOutLoanApiService.getVisitProposer(mcrVisitProposerQC);
            BaseLogUtils.info(logger, "toAddmcrCstCreditRecPage", "获取信审员信息.project:"+projectId+",result:"+JSONObject.toJSONString(visitProposer));
            if (CollectionUtils.isEmpty(visitProposer) || !isDetail.equals("1")){
                KeyValueVO kvv = new KeyValueVO();
                kvv.setKey(CurrentThreadContext.getCurrentUserId().toString());
                kvv.setValue(CurrentThreadContext.getCurrentUserName());
                auditUsrKVList.add(kvv);
            }else {
                McrVisitProposerDTO mcrVisitProposerDTO = visitProposer.get(0);
                KeyValueVO kvv = new KeyValueVO();
                kvv.setKey(mcrVisitProposerDTO.getAuditorId().toString());
                kvv.setValue(mcrVisitProposerDTO.getAuditorName());
                auditUsrKVList.add(kvv);
            }
            view.addObject("auditUsrKVListJSON", JSON.toJSON(auditUsrKVList));

            // 获取行驶证图片信息
	        SysUlFilesRecQueryCondition sysUlFilesRecQueryCondition = new SysUlFilesRecQueryCondition();
	        sysUlFilesRecQueryCondition.setPkId(carId);
	        sysUlFilesRecQueryCondition.setCfgCd(PropertiesCacheUtils.getProperty(UploadConstant.CFG_INS_VEH_LIC_CD));
	        sysUlFilesRecQueryCondition.setOrgCd(PropertiesCacheUtils.getProperty(SystemConstant.INS_USE_ORG_CD));
	        sysUlFilesRecQueryCondition.setSysCd(PropertiesCacheUtils.getProperty(SystemConstant.INS_SERVICE_CD));
	        BaseLogUtils.info(logger, "toAddmcrCstCreditRecPage", "信审回访.配置文件：" + JSON.toJSONString(sysUlFilesRecQueryCondition));
	        List<SysUlFilesRecVO> listFilesVo = SysUlFilesRecVOTransform.toVOList(this.uploadApiService.searchSysUlFilesRecNoUrlPrefixList(sysUlFilesRecQueryCondition));
	        BaseLogUtils.info(logger, "toAddmcrCstCreditRecPage", "信审回访.行驶证信息：" + JSON.toJSONString(listFilesVo));
	        if (CollectionUtils.isNotEmpty(listFilesVo)) {
	            String servicePath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
	            for (SysUlFilesRecVO sysUlFilesRecVo : listFilesVo) {
	                if (PropertiesCacheUtils.getProperty(UploadConstant.CFG_DTL_VEH_LIC_10).equals(sysUlFilesRecVo.getCfgDtlCd())) {
	                    view.addObject("driFirPho", servicePath + sysUlFilesRecVo.getFilePath());
	                } else if (PropertiesCacheUtils.getProperty(UploadConstant.CFG_DTL_VEH_LIC_20).equals(sysUlFilesRecVo.getCfgDtlCd())) {
	                    view.addObject("driSecPho", servicePath + sysUlFilesRecVo.getFilePath());
	                }
	            }
	        }

	        // 获取照片信息
            this.getParamPhoto(view,usrId);

        } catch (Exception e) {
			e.printStackTrace();
			BaseLogUtils.error(logger, "toAddmcrCstCreditRecPage", "toAddmcrCstCreditRecPage错误信息："+e.getMessage());
		}
        BaseLogUtils.info(logger, "toAddPage", "跳转到修改页面.[projectId=" + projectId + "]", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 获取图片信息(信审回访)
     * @param view
     * @return
     */
    private ModelAndView getParamPhoto(ModelAndView view,String usrId){
        if (StringUtils.isEmpty(usrId)){
            BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).用户信息为空");
            return view;
        }

        try{
            // 获取车辆图片信息
            BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).开始获取车辆图片.usrId:"+usrId);
            List<SysUlFilesRecDTO> carVehicleImages = this.mcrOutLoanApiService.getCarVehicleImages(usrId);
            if (CollectionUtils.isNotEmpty(carVehicleImages)){
                BaseLogUtils.info(logger,"getParamPhoto","获取图片信息(信审回访).获取车辆照片图片返回结果.result:"+JSONObject.toJSONString(carVehicleImages));
                String servicePath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
                for (SysUlFilesRecDTO carVehicleImage : carVehicleImages) {
                    if ("10".equals(carVehicleImage.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).车辆正面图片获取成功.usrId:"+usrId+",path:"+carVehicleImage.getFilePath());
                        view.addObject("driCarFrontPho", carVehicleImage.getFilePath());
                    }else if ("20".equals(carVehicleImage.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).车辆侧面图片获取成功.usrId:"+usrId+",path:"+carVehicleImage.getFilePath());
                        view.addObject("driCarSidePho", carVehicleImage.getFilePath());
                    }
                }
            }

            // 获取身份证信息
            BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).开始获取身份证图片.usrId:"+usrId);
            List<SysUlFilesRecDTO> sysUlFileCertList = this.getSysUlFileCertList(usrId);
            if (CollectionUtils.isNotEmpty(sysUlFileCertList)){
                BaseLogUtils.info(logger,"getParamPhoto","获取图片信息(信审回访).获取身份证图片返回结果.result:"+JSONObject.toJSONString(carVehicleImages));
                String servicePath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
                for (SysUlFilesRecDTO sysUlFilesRecDTO : sysUlFileCertList) {
                    // 身份证正面  10  用户ID
                    if (McrCstCrLimAppConstant.CODE_CD_CERTIFI001.equals(sysUlFilesRecDTO.getCfgCd()) && McrCstCrLimAppConstant.ID_CARD_DTL_10.equals(sysUlFilesRecDTO.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).身份证正面图片获取成功.usrId:"+usrId+",path:"+sysUlFilesRecDTO.getFilePath());
                        view.addObject("certUlFileFront",sysUlFilesRecDTO.getFilePath());
                        view.addObject("certFrontUlFileName",sysUlFilesRecDTO.getFileNm());
                    }
                    // 身份证反面  20  用户ID
                    if (McrCstCrLimAppConstant.CODE_CD_CERTIFI001.equals(sysUlFilesRecDTO.getCfgCd()) && McrCstCrLimAppConstant.ID_CARD_DTL_BACK_20.equals(sysUlFilesRecDTO.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).身份证反面图片获取成功.usrId:"+usrId+",path:"+sysUlFilesRecDTO.getFilePath());
                        view.addObject("certUlFileBack",sysUlFilesRecDTO.getFilePath());
                        view.addObject("certBackUlFileName",sysUlFilesRecDTO.getFileNm());
                    }
                    // 身份证正面  10  客户ID
                    if (McrCstCrLimAppConstant.CODE_CD_CST004.equals(sysUlFilesRecDTO.getCfgCd()) && McrCstCrLimAppConstant.ID_CARD_DTL_10.equals(sysUlFilesRecDTO.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).身份证正面图片获取成功.cstId:"+sysUlFilesRecDTO.getPkId()+",path:"+sysUlFilesRecDTO.getFilePath());
                        view.addObject("certUlFileFront",sysUlFilesRecDTO.getFilePath());
                        view.addObject("certFrontUlFileName",sysUlFilesRecDTO.getFileNm());
                    }
                    // 身份证反面  20  客户ID
                    if (McrCstCrLimAppConstant.CODE_CD_CST004.equals(sysUlFilesRecDTO.getCfgCd()) && McrCstCrLimAppConstant.ID_CARD_DTL_BACK_11.equals(sysUlFilesRecDTO.getCfgDtlCd())){
                        BaseLogUtils.info(logger, "getParamPhoto", "获取图片信息(信审回访).身份证反面图片获取成功.cstId:"+sysUlFilesRecDTO.getPkId()+",path:"+sysUlFilesRecDTO.getFilePath());
                        view.addObject("certUlFileBack",sysUlFilesRecDTO.getFilePath());
                        view.addObject("certBackUlFileName",sysUlFilesRecDTO.getFileNm());
                    }
                }
            }
        }catch (BaseException ex){
            BaseLogUtils.error(logger,"getParamPhoto","获取图片信息(信审回访).异常.ex:"+ex.getMessage(),ex);
        }catch (Exception ex){
            BaseLogUtils.error(logger,"getParamPhoto","获取图片信息(信审回访).异常.ex:"+ex.getMessage(),ex);
        }
        return view;
    }

    /**
     * 获取身份证附件信息
     * @param usrId
     * @return
     */
    private List<SysUlFilesRecDTO> getSysUlFileCertList(String usrId){
        BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.开始获取身份证图片信息.usrId:"+usrId);
        List<SysUlFilesRecDTO> sysUlFilesRecDTOS = new ArrayList<>();
        try{
            // 根据用户ID获取用户信息
            SysUlFilesRecQueryCondition queryCondition = new SysUlFilesRecQueryCondition();
            queryCondition.setSysCd(PropertiesCacheUtils.getProperty(SystemConstant.FL_SERVICE_CD));
            queryCondition.setPkId(usrId);
            queryCondition.setCfgCd(McrCstCrLimAppConstant.CODE_CD_CERTIFI001);
            BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.根据用户ID查询身份证参数.param:"+JSONObject.toJSONString(queryCondition));
            sysUlFilesRecDTOS = this.uploadApiService.searchSysUlFilesRecList(queryCondition);

            // 查询客户ID 根据客户ID查询证件附件
            if (CollectionUtils.isEmpty(sysUlFilesRecDTOS)){
                BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.开始查询客户ID.usrId:"+usrId);
                List<CstBscInfoDTO> cstBscInfoDTOS = this.customerApiService.searchListByUsrId(Long.valueOf(usrId));
                if (CollectionUtils.isEmpty(cstBscInfoDTOS)){
                    BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.未获取到客户信息.usrId:"+usrId);
                    return sysUlFilesRecDTOS;
                }

                // 根据客户ID获取证件附件信息
                CstBscInfoDTO cstBscInfoDTO = cstBscInfoDTOS.get(0);
                queryCondition.setPkId(String.valueOf(cstBscInfoDTO.getId()));
                queryCondition.setCfgCd(McrCstCrLimAppConstant.CODE_CD_CST004);
                BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.根据客户ID查询身份证.param:"+JSONObject.toJSONString(queryCondition));
                sysUlFilesRecDTOS = this.uploadApiService.searchSysUlFilesRecList(queryCondition);
            }

        }catch (BaseException ex){
            BaseLogUtils.error(logger,"getSysUlFileCertList","获取身份证信息异常.异常.ex:"+ex.getMessage(),ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,ex.getMessage());
        }catch (Exception ex){
            BaseLogUtils.error(logger,"getSysUlFileCertList","获取身份证信息异常.异常.ex:"+ex.getMessage(),ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,ex.getMessage());
        }
        BaseLogUtils.info(logger, "getSysUlFileCertList", "获取身份证信息.获取身份证图片信息结果.usrId:"+usrId+",param:"+JSONObject.toJSONString(sysUlFilesRecDTOS));
        return sysUlFilesRecDTOS;
    }


    @RequestMapping(value = "/getInsVehicleById.do")
    @ResponseBody
    public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "getById", "根据主键获取对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "操作成功!");
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("主键不能为空!");
            BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        try {
            InsVehicleLicenseVO vo = InsVehicleLicenseVOTransform.toVO(this.insQueryApiService.selectById(Long.valueOf(id)));
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("数据不存在!");
                BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
            }
            result.setData(vo);
            BaseLogUtils.info(logger, "getById", "获取数据.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "getById", "根据主键获取对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "getById", "根据主键获取对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "getById", "根据主键获取对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());

        return result;
    }

    /**
     * 修改行驶证状态：1.未确认；2.已确认
     */
    @RequestMapping(value = "/modifyVehicle.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modifyVehicle(HttpServletRequest request, HttpServletResponse response, InsVehicleLicenseVO entity) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "modify", "修改对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "修改成功!");
        if (entity == null) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("数据不存在!");
            BaseLogUtils.info(logger, "modify", "修改数据,数据为空.[entity=" + entity + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }
        if (StringUtils.isEmpty(entity.getId())) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("主键数据不存在!");
            BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id=" + entity.getId() + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
        try {
            InsVehicleLicenseDTO dto = InsVehicleLicenseVOTransform.toDTO(entity);
            dto.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            boolean success = this.insModifyApiService.modifyInsVehicleLicense(dto);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("修改失败!");
                BaseLogUtils.info(logger, "modify", "修改失败.[id=" + entity.getId() + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
            }
            BaseLogUtils.info(logger, "modify", "修改成功.[id=" + entity.getId() + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "modify", "修改对象失败,id[" + entity.getId() + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "modify", "修改对象失败,id[" + entity.getId() + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "modify", "修改对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());

        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/addMcrCstCreditRec.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addMcrCstCreditRec(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        McrVisitVO entity = null;
        try {
            // 获取web所传输参数
            entity = this.getMcrVisitAddParam(request);
            String auditVisitStatus = request.getParameter("auditVisitStatus");
            if (auditVisitStatus == null) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("审核状态不能为空");
                return result;
            }

            Long id = this.mcrCstCreditRecService.addAudReturnVisit(entity, Integer.parseInt(auditVisitStatus));
            result.setData(id);
            BaseLogUtils.info(logger, "add", "新增数据.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), ex);
        }

        return result;
    }

    /**
     * 获取参数
     * @param request
     * @return
     */
    private McrVisitVO getMcrVisitAddParam(HttpServletRequest request)throws BaseException{
        McrVisitVO mcrVisitVO = new McrVisitVO();
        Long projectId = null;
        try{
            String projectIdStr = request.getParameter("projectId");
            if (StringUtils.isEmpty(projectIdStr)){
                BaseLogUtils.info(logger,"getMcrVisitAddParam","获取授信参数.projectId为空");
                throw new BaseException(BaseExceptionConstant.COMMON_0002,"projectId为空");
            }
            projectId = Long.valueOf(projectIdStr);
            BaseLogUtils.info(logger,"getMcrVisitAddParam","获取授信参数.开始获取授信参数.projectId:"+projectId);

            mcrVisitVO.setProjectId(projectId);

            // 申请人信息
            String proposerName = request.getParameter("proposerName");
            String proposerCertNo = request.getParameter("proposerCertNo");
            String visitPhone = request.getParameter("visitPhone");
            String visitDate = request.getParameter("visitDate");
            String isSelfAnswer = request.getParameter("isSelfAnswer");
            String identityCd = request.getParameter("identityCd");
            String addressCd = request.getParameter("addressCd");
            String address = request.getParameter("address");
            String visitStates = request.getParameter("auditVisitStatus");
            String auditorNm = request.getParameter("auditorNm");
            String auditorId = request.getParameter("auditorId");

            McrVisitProposerDTO mcrVisitProposerDTO = new McrVisitProposerDTO();
            mcrVisitProposerDTO.setProposerName(proposerName);
            mcrVisitProposerDTO.setProposerCertNo(proposerCertNo);
            mcrVisitProposerDTO.setAuditorName(auditorNm);
            mcrVisitProposerDTO.setVisitPhone(visitPhone);
            if (StringUtils.isNotEmpty(visitDate)){
                Date date = DateUtils.formatStringToDate(visitDate, "yyyy-MM-dd HH:mm");
                BaseLogUtils.info(logger,"getMcrVisitAddParam","获取授信参数.授信时间：visitDate:"+JSONObject.toJSONString(date));
                mcrVisitProposerDTO.setVisitDate(date);
            }
            mcrVisitProposerDTO.setIsSelfAnswer(isSelfAnswer);
            mcrVisitProposerDTO.setIdentityCd(identityCd);
            mcrVisitProposerDTO.setAddressCd(addressCd);
            mcrVisitProposerDTO.setAddress(address);
            mcrVisitProposerDTO.setVisitStates(visitStates);
            mcrVisitProposerDTO.setProjectId(projectId);
            mcrVisitProposerDTO.setIsValid(BaseConstant.IS_YESNO_YES);
            mcrVisitProposerDTO.setIsDel(BaseConstant.IS_YESNO_NO);
            if (StringUtils.isNotEmpty(auditorId)){
                mcrVisitProposerDTO.setAuditorId(Long.valueOf(auditorId));
            }
            mcrVisitVO.setMcrVisitProposerDTO(mcrVisitProposerDTO);


            // 驾驶证信息
            String isDriverVisitInfo = request.getParameter("isDriverVisitInfo");
            String driverType = request.getParameter("driverType");
            String carType = request.getParameter("carType");
            String driverStates = request.getParameter("driverStates");
            String driverScore = request.getParameter("driverScore");
            String driverVaildDate = request.getParameter("driverVaildDate");
            String allowCarType = request.getParameter("allowCarType");

            McrVisitDriverDTO mcrVisitDriverDTO = new McrVisitDriverDTO();
            mcrVisitDriverDTO.setIsDriverVisitInfo(isDriverVisitInfo);
            mcrVisitDriverDTO.setDriverType(driverType);
            mcrVisitDriverDTO.setCarType(carType);
            mcrVisitDriverDTO.setDriverStates(driverStates);
            mcrVisitDriverDTO.setDriverScore(driverScore);
            mcrVisitDriverDTO.setDriverValidDate(driverVaildDate);
            mcrVisitDriverDTO.setAllowCarType(allowCarType);
            mcrVisitDriverDTO.setProjectId(projectId);
            mcrVisitDriverDTO.setIsValid(BaseConstant.IS_YESNO_YES);
            mcrVisitDriverDTO.setIsDel(BaseConstant.IS_YESNO_NO);
            mcrVisitVO.setMcrVisitDriverDTO(mcrVisitDriverDTO);

            // 车辆信息
            String capitalNumber = request.getParameter("capitalNumber");
            String isCarVisitInfo = request.getParameter("isCarVisitInfo");
            String carBrand = request.getParameter("carBrand");
            String plateNo = request.getParameter("plateNo");
            String innerCorSize = request.getParameter("innerCorSize");
            String outCorSize = request.getParameter("outCorSize");
            String carColor = request.getParameter("carColor");
            String carArea = request.getParameter("carArea");
            String buyDate = request.getParameter("buyDate");
            String firstInterDate = request.getParameter("firstInterDate");
            String vclAxs = request.getParameter("vclAxs");
            String vclTn = request.getParameter("vclTn");
            String ldTn = request.getParameter("ldTn");
            String fuelType = request.getParameter("fuelType");
            String ownerName = request.getParameter("ownerName");
            String ownerType = request.getParameter("ownerType");
            String relyCompRel = request.getParameter("relyCompRel");
            String relyMoney = request.getParameter("relyMoney");
            String tenantType = request.getParameter("tenantType");
            String enginePower = request.getParameter("enginePower");
            String carType1 = request.getParameter("carType1");

            McrVisitCarDTO mcrVisitCarDTO = new McrVisitCarDTO();
            mcrVisitCarDTO.setCapitalNumber(capitalNumber);
            mcrVisitCarDTO.setIsCarVisitInfo(isCarVisitInfo);
            mcrVisitCarDTO.setCarBrand(carBrand);
            mcrVisitCarDTO.setPlateNo(plateNo);
            mcrVisitCarDTO.setInnerCorSize(innerCorSize);
            mcrVisitCarDTO.setOutCorSize(outCorSize);
            mcrVisitCarDTO.setCarColor(carColor);
            mcrVisitCarDTO.setCarArea(carArea);
            if (StringUtils.isNotEmpty(buyDate)){
                mcrVisitCarDTO.setBuyDate(DateUtils.formatStringToDate(buyDate,"yyyy-MM-dd"));
            }
            if (StringUtils.isNotEmpty(firstInterDate)){
                mcrVisitCarDTO.setFirstInterDate(DateUtils.formatStringToDate(firstInterDate,"yyyy-MM-dd"));
            }
            mcrVisitCarDTO.setVclAxs(vclAxs);
            mcrVisitCarDTO.setVclTn(vclTn);
            mcrVisitCarDTO.setLdTn(ldTn);
            mcrVisitCarDTO.setFuelType(fuelType);
            mcrVisitCarDTO.setOwnerName(ownerName);
            mcrVisitCarDTO.setOwnerType(ownerType);
            mcrVisitCarDTO.setRelyCompRel(relyCompRel);
            if (StringUtils.isNotEmpty(relyMoney)){
                mcrVisitCarDTO.setRelyMoney(MoneyConvert.yuan2Fen(new BigDecimal(relyMoney)));
            }
            mcrVisitCarDTO.setTenantType(tenantType);
            mcrVisitCarDTO.setEnginePower(enginePower);
            mcrVisitCarDTO.setCarModel(carType1);
            mcrVisitCarDTO.setProjectId(projectId);
            mcrVisitCarDTO.setIsValid(BaseConstant.IS_YESNO_YES);
            mcrVisitCarDTO.setIsDel(BaseConstant.IS_YESNO_NO);
            mcrVisitVO.setMcrVisitCarDTO(mcrVisitCarDTO);
            mcrVisitVO.setCarType(carType1);


            // 车辆运营信息
            String mainCargoType = request.getParameter("mainCargoType");
            String mainTrafficCargo = request.getParameter("mainTrafficCargo");
            String trafficLine = request.getParameter("trafficLine");
            String twoThridLine = request.getParameter("twoThridLine");
            String oneWeekLine = request.getParameter("oneWeekLine");
            String firstWeekLine = request.getParameter("firstWeekLine");
            String driverInfo = request.getParameter("driverInfo");
            String cargoSource = request.getParameter("cargoSource");
            String selftCarInfo = request.getParameter("selftCarInfo");
            String carBusYear = request.getParameter("carBusYear");
            String useLoan = request.getParameter("useLoan");
            String askNumber = request.getParameter("askNumber");
            String remark = request.getParameter("remark");
            String remarkMsg = request.getParameter("remarkMsg");

            McrVisitCarBusDTO mcrVisitCarBusDTO = new McrVisitCarBusDTO();
            mcrVisitCarBusDTO.setMainCargoType(mainCargoType);
            mcrVisitCarBusDTO.setMainTrafficCargo(mainTrafficCargo);
            mcrVisitCarBusDTO.setTrafficLine(trafficLine);
            mcrVisitCarBusDTO.setTwoThridLine(twoThridLine);
            mcrVisitCarBusDTO.setOneWeekLine(oneWeekLine);
            mcrVisitCarBusDTO.setFirstWeekLine(firstWeekLine);
            mcrVisitCarBusDTO.setDriverInfo(driverInfo);
            mcrVisitCarBusDTO.setCargoSource(cargoSource);
            mcrVisitCarBusDTO.setSelftCarInfo(selftCarInfo);
            mcrVisitCarBusDTO.setCarBusYear(carBusYear);
            mcrVisitCarBusDTO.setUseLoan(useLoan);
            mcrVisitCarBusDTO.setAskNumber(askNumber);
            mcrVisitCarBusDTO.setRemark(remark);
            mcrVisitCarBusDTO.setProjectId(projectId);
            mcrVisitCarBusDTO.setIsValid(BaseConstant.IS_YESNO_YES);
            mcrVisitCarBusDTO.setIsDel(BaseConstant.IS_YESNO_NO);
            mcrVisitVO.setMcrVisitCarBusDTO(mcrVisitCarBusDTO);

            String additionalCd = request.getParameter("additionalCd");
            mcrVisitVO.setAdditionalCd(additionalCd);
            mcrVisitVO.setRemarkMsg(remarkMsg);

        }catch (BaseException ex){
            BaseLogUtils.error(logger,"getMcrVisitAddParam","获取授信参数.异常.projectId:"+projectId+",ex:"+ex.getMessage(),ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,"获取参数异常");
        }catch (Exception ex){
            BaseLogUtils.error(logger,"getMcrVisitAddParam","获取授信参数.异常.projectId:"+projectId+",ex:"+ex.getMessage(),ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,"获取参数异常");
        }
        BaseLogUtils.info(logger,"getMcrVisitAddParam","获取授信参数.参数获取结束.projectId:"+projectId);
        return mcrVisitVO;
    }

    /**
     * 获取授信记录初始化数据
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/getMcrVisitParam.do",method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public DataResultVO getMcrVisitParam(HttpServletRequest request,HttpServletResponse response){
        Long startTm = System.currentTimeMillis();
        final String methodName = "methodName";
        BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());
        DataResultVO resultVO = new DataResultVO(BaseConstant.IS_YESNO_YES, "参数获取成功", "");

        String project = request.getParameter("project");
        String isDetail = request.getParameter("isDetail"); // 是否详情标识(1:详情页面不可编辑,操作按钮隐藏)
        String plateNo = request.getParameter("plateNo");
        String usrId = request.getParameter("usrId");
        if (StringUtils.isEmpty(project)){
            resultVO.setSuccess(BaseConstant.IS_YESNO_NO);
            resultVO.setInfo("项目Id为空");
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.项目Id为空:" +  CurrentThreadContext.getCurrentUserName());
            return  resultVO;
        }
        if (StringUtils.isEmpty(usrId)){
            resultVO.setSuccess(BaseConstant.IS_YESNO_NO);
            resultVO.setInfo("用户Id为空");
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.用户Id为空:" +  CurrentThreadContext.getCurrentUserName());
            return  resultVO;
        }
        if (StringUtils.isEmpty(plateNo)){
            resultVO.setSuccess(BaseConstant.IS_YESNO_NO);
            resultVO.setInfo("车牌号为空");
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.车牌号为空:" +  CurrentThreadContext.getCurrentUserName());
            return  resultVO;
        }

        Map<String, Object> resultMap = new HashMap<>();  // 返回参数
        try{
            // 获取参数
            this.getParamVisit(project,resultMap,isDetail,plateNo,usrId);

            resultVO.setData(resultMap);
        }catch (BaseException ex) {
            resultVO.setSuccess(BaseConstant.IS_YESNO_NO);
            resultVO.setInfo(ex.getMessage());
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.DATA:" +  ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            resultVO.setSuccess(BaseConstant.IS_YESNO_NO);
            resultVO.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger,methodName, "获取授信记录初始化数据.DATA:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return resultVO;
    }

    /**
     * 获取授信接口
     * @param project 小贷授信Id
     * @param resultMap 返回前端数据
     * @param isDetail 1.不可编辑
     * @param plateNo 车牌号
     * @param usrId 用户ID
     * @throws BaseException 异常
     */
    private void getParamVisit(String project,Map<String,Object> resultMap,String isDetail,String plateNo,String usrId)throws BaseException{
        final String methodName = "getParamVisit";
        BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.开始获取:project:"+project+",usrId:"+usrId);
        McrVisitProposerDTO mcrVisitProposerDTO;   // 审核人信息
        McrVisitDriverDTO mcrVisitDriverDTO;       // 驾驶证信息
        McrVisitCarDTO mcrVisitCarDTO;             // 车辆信息
        McrVisitCarBusDTO mcrVisitCarBusDTO;       // 车辆运营信息
        try{
            // 查询申请人信息
            McrVisitProposerQC mcrVisitProposerQC = new McrVisitProposerQC();
            mcrVisitProposerQC.setProjectId(Long.valueOf(project));
            mcrVisitProposerQC.setIsDel(BaseConstant.IS_YESNO_NO);
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.开始查询申请人信息:project:"+project+",usrId:"+usrId);
            List<McrVisitProposerDTO> visitProposerList = this.mcrOutLoanApiService.getVisitProposer(mcrVisitProposerQC);
            BaseLogUtils.info(logger,methodName,"获取授信记录初始化参数.获取申请人返回信息:project:"+project+",param:"+JSONObject.toJSONString(visitProposerList));
            if (CollectionUtils.isNotEmpty(visitProposerList)){
                mcrVisitProposerDTO = visitProposerList.get(0);
                resultMap.put("proposerName",mcrVisitProposerDTO.getProposerName());
                resultMap.put("proposerCertNo",mcrVisitProposerDTO.getProposerCertNo());
                resultMap.put("auditorName",mcrVisitProposerDTO.getAuditorName());
                resultMap.put("auditorId",mcrVisitProposerDTO.getAuditorId());
                resultMap.put("visitPhone",mcrVisitProposerDTO.getVisitPhone());
                resultMap.put("visitDate",DateUtils.formatDateToString(mcrVisitProposerDTO.getVisitDate(),"yyyy-MM-dd"));
                resultMap.put("isSelfAnswer",mcrVisitProposerDTO.getIsSelfAnswer());
                resultMap.put("identityCd",mcrVisitProposerDTO.getIdentityCd());
                resultMap.put("addressCd",mcrVisitProposerDTO.getAddressCd());
                resultMap.put("address",mcrVisitProposerDTO.getAddress());
                resultMap.put("visitStates",mcrVisitProposerDTO.getVisitStates());
            }

            // 获取驾驶证信息
            McrVisitDriverQC mcrVisitDriverQC = new McrVisitDriverQC();
            mcrVisitDriverQC.setProjectId(Long.valueOf(project));
            mcrVisitDriverQC.setIsDel(BaseConstant.IS_YESNO_NO);
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.开始查询驾驶证:project:"+project+",usrId:"+usrId);
            List<McrVisitDriverDTO> visitDriverDTOList = this.mcrOutLoanApiService.getVisitDriver(mcrVisitDriverQC);
            BaseLogUtils.info(logger,methodName,"获取授信记录初始化参数.获取驾驶证返回信息:project:"+project+",param:"+JSONObject.toJSONString(visitDriverDTOList));
            if (CollectionUtils.isNotEmpty(visitDriverDTOList)){
                mcrVisitDriverDTO = visitDriverDTOList.get(0);
                resultMap.put("isDriverVisitInfo",mcrVisitDriverDTO.getIsDriverVisitInfo());
                resultMap.put("driverType",mcrVisitDriverDTO.getDriverType());
                resultMap.put("carType",mcrVisitDriverDTO.getCarType());
                resultMap.put("driverStates",mcrVisitDriverDTO.getDriverStates());
                resultMap.put("driverScore",mcrVisitDriverDTO.getDriverScore());
                resultMap.put("driverValidDate",mcrVisitDriverDTO.getDriverValidDate());
                resultMap.put("allowCarType",mcrVisitDriverDTO.getAllowCarType());
            }

            // 获取车辆信息
            McrVisitCarQC mcrVisitCarQC = new McrVisitCarQC();
            mcrVisitCarQC.setProjectId(Long.valueOf(project));
            mcrVisitCarQC.setIsDel(BaseConstant.IS_YESNO_NO);
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.开始查询车辆信息:project:"+project+",usrId:"+usrId);
            List<McrVisitCarDTO> visitCarDTOList = this.mcrOutLoanApiService.getVisitCar(mcrVisitCarQC);
            BaseLogUtils.info(logger,methodName,"获取授信记录初始化参数.获取车辆返回信息:project:"+project+",param:"+JSONObject.toJSONString(visitCarDTOList));
            if (CollectionUtils.isNotEmpty(visitCarDTOList)){
                mcrVisitCarDTO = visitCarDTOList.get(0);
                resultMap.put("capitalNumber",mcrVisitCarDTO.getCapitalNumber());
                resultMap.put("isCarVisitInfo",mcrVisitCarDTO.getIsCarVisitInfo());
                resultMap.put("carBrand",mcrVisitCarDTO.getCarBrand());
                resultMap.put("plateNo",mcrVisitCarDTO.getPlateNo());
                resultMap.put("innerCorSize",mcrVisitCarDTO.getInnerCorSize());
                resultMap.put("outCorSize",mcrVisitCarDTO.getOutCorSize());
                resultMap.put("carColor",mcrVisitCarDTO.getCarColor());
                resultMap.put("carArea",mcrVisitCarDTO.getCarArea());
                resultMap.put("buyDate",mcrVisitCarDTO.getBuyDate());
                resultMap.put("firstInterDate",mcrVisitCarDTO.getFirstInterDate());
                resultMap.put("vclAxs",mcrVisitCarDTO.getVclAxs());
                resultMap.put("vclTn",mcrVisitCarDTO.getVclTn());
                resultMap.put("ldTn",mcrVisitCarDTO.getLdTn());
                resultMap.put("fuelType",mcrVisitCarDTO.getFuelType());
                resultMap.put("ownerName",mcrVisitCarDTO.getOwnerName());
                resultMap.put("ownerType",mcrVisitCarDTO.getOwnerType());
                resultMap.put("relyCompRel",mcrVisitCarDTO.getRelyCompRel());
                resultMap.put("relyMoney",mcrVisitCarDTO.getRelyMoney());
                resultMap.put("tenantType",mcrVisitCarDTO.getTenantType());
                resultMap.put("enginePower",mcrVisitCarDTO.getEnginePower());
                resultMap.put("carType1",mcrVisitCarDTO.getCarModel());
            }

            // 获取车运营信息
            McrVisitCarBusQC mcrVisitCarBusQC = new McrVisitCarBusQC();
            mcrVisitCarBusQC.setProjectId(Long.valueOf(project));
            mcrVisitCarBusQC.setIsDel(BaseConstant.IS_YESNO_NO);
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.开始查询车辆运营信息:project:"+project+",usrId:"+usrId);
            List<McrVisitCarBusDTO> visitCarBusDTOList = this.mcrOutLoanApiService.getVisitCarBus(mcrVisitCarBusQC);
            BaseLogUtils.info(logger,methodName,"获取授信记录初始化参数.获取车辆运营返回信息:project:"+project+",param:"+JSONObject.toJSONString(visitCarBusDTOList));
            if (CollectionUtils.isNotEmpty(visitCarBusDTOList)){
                mcrVisitCarBusDTO = visitCarBusDTOList.get(0);
                resultMap.put("mainCargoType",mcrVisitCarBusDTO.getMainCargoType());
                resultMap.put("mainTrafficCargo",mcrVisitCarBusDTO.getMainTrafficCargo());
                resultMap.put("trafficLine",mcrVisitCarBusDTO.getTrafficLine());
                resultMap.put("twoThridLine",mcrVisitCarBusDTO.getTwoThridLine());
                resultMap.put("oneWeekLine",mcrVisitCarBusDTO.getOneWeekLine());
                resultMap.put("firstWeekLine",mcrVisitCarBusDTO.getFirstWeekLine());
                resultMap.put("driverInfo",mcrVisitCarBusDTO.getDriverInfo());
                resultMap.put("cargoSource",mcrVisitCarBusDTO.getCargoSource());
                resultMap.put("selftCarInfo",mcrVisitCarBusDTO.getSelftCarInfo());
                resultMap.put("carBusYear",mcrVisitCarBusDTO.getCarBusYear());
                resultMap.put("useLoan",mcrVisitCarBusDTO.getUseLoan());
                resultMap.put("askNumber",mcrVisitCarBusDTO.getAskNumber());
                resultMap.put("remark",mcrVisitCarBusDTO.getRemark());
            }

            // 获取三方信息
            if (!"1".equals(isDetail)){
                // 获取用户信息（身份证号）
                SysUsrDTO sysUsrDTO = this.sysUsrApiService.selectSysUsrById(Long.valueOf(usrId),
                        PropertiesUtils.getProperty(SystemConstant.FL_SERVICE_CD),  PropertiesUtils.getProperty(SystemConstant.FL_ORG_CD));
                BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.用户信息获取完毕:project:"+project+",usrId:"+usrId);
                if(null == sysUsrDTO || StringUtils.isEmpty(sysUsrDTO.getRefCertNo())){
                    BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.未获取到用户信息:usrId:"+usrId+",project:"+project);
                    throw new BaseException(BaseExceptionConstant.COMMON_0002,"未获取到用户信息");
                }

                // 获取驾驶证信息
                BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.获取三方驾驶证信息请求参数:project:"+project+",usrId:"+usrId+",certNo:"+sysUsrDTO.getRefCertNo());
                DataResultDTO  mcrTripartiteDTO = this.mcrTripartiteApiService.getVehicleByCertNo(sysUsrDTO.getRefCertNo(),Long.parseLong(usrId));
                BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.获取三方驾驶证信息:project:"+project+",result:"+JSONObject.toJSONString(mcrTripartiteDTO));
                if (null != mcrTripartiteDTO && BaseConstant.IS_YESNO_YES == mcrTripartiteDTO.getSuccess()){
                    String jsonString = JSONObject.toJSONString(mcrTripartiteDTO.getData());
                    JSONObject jsonObject = JSONObject.parseObject(jsonString);
                    resultMap.put("driverType",jsonObject.getString("classVehicleModel")); // 驾驶证类型
                    resultMap.put("driverScore",jsonObject.getString("score"));            // 驾驶证分
                    resultMap.put("driverStates",jsonObject.getString("status"));          // 驾驶证状态
                    String issueDate1 = jsonObject.getString("issueDate");
                    String expiryDate1 = jsonObject.getString("expiryDate");
                    if (StringUtils.isNotEmpty(issueDate1) && StringUtils.isNotEmpty(expiryDate1)){
                        Date issueDate = DateUtils.formatStringToDate(issueDate1, "yyyy-MM-dd");   // 初次领证日期
                        String issueDateStr = DateUtils.formatDateToString(issueDate, "yyyy-MM-dd");
                        Date expiryDate = DateUtils.formatStringToDate(expiryDate1, "yyyy-MM-dd"); // 有效期至
                        String expiryDateStr = DateUtils.formatDateToString(expiryDate, "yyyy-MM-dd");
                        resultMap.put("driverValidDate",issueDateStr+" - "+expiryDateStr);
                    }
                }

                // 获取车辆信息
                BaseLogUtils.info(logger,methodName, "获取授信记录初始化数据.根据车牌号查询车辆信息:project:"+project+",plateNo:"+plateNo);
                DataResultDTO vehicleByPlateNo  = this.mcrTripartiteApiService.getVehicleByPlateNo(plateNo);
                BaseLogUtils.info(logger,methodName,"获取授信记录初始化数据.获取三方车辆信息:project:"+project+",result:"+JSONObject.toJSONString(vehicleByPlateNo));
                if (null != vehicleByPlateNo && BaseConstant.IS_YESNO_YES == vehicleByPlateNo.getSuccess()){
                    JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(vehicleByPlateNo.getData()));
                    resultMap.put("carType",jsonObject.getString("vclTpNm"));    // 车类型
                    resultMap.put("carBrand",jsonObject.getString("vclTpNm"));   // 品牌型号
                    resultMap.put("carColor",jsonObject.getString("carColor"));  // 车身颜色
                    resultMap.put("carArea",jsonObject.getString("areaName"));   // 车籍地
                    resultMap.put("vclAxs",jsonObject.getString("vclAxs"));      // 轴数
                    resultMap.put("vclTn",jsonObject.getString("vclTn"));        // 车辆总质量
                    resultMap.put("ldTn",jsonObject.getString("ldTn"));          // 核定载质量
                    String boxLng = jsonObject.getString("boxLng"); // 货厢内部尺寸长(mm)
                    String boxWdt = jsonObject.getString("boxWdt"); // 货厢内部尺寸宽(mm)
                    String boxHgt = jsonObject.getString("boxHgt"); // 货厢内部尺寸高(mm)
                    String vclLng = jsonObject.getString("vclLng"); // 外廓尺寸-长(mm)
                    String vclWdt = jsonObject.getString("vclWdt"); // 外廓尺寸-宽(mm)
                    String vclHgt = jsonObject.getString("vclHgt"); // 外廓尺寸-高(mm)
                    String buyDate = jsonObject.getString("buyDate"); // 购买(注册)日期
                    String firstSysutc = jsonObject.getString("firstSysutc"); // 首次入网时间

                    // 内廊尺寸
                    if(StringUtils.isNotEmpty(boxLng) && StringUtils.isNotEmpty(boxWdt) && StringUtils.isNotEmpty(boxHgt)){
                        resultMap.put("innerCorSize",boxLng+"*"+boxWdt+"*"+boxHgt);
                    }
                    // 外廓尺寸
                    if(StringUtils.isNotEmpty(vclLng) && StringUtils.isNotEmpty(vclWdt) && StringUtils.isNotEmpty(vclHgt)){
                        resultMap.put("outCorSize",vclLng+"*"+vclWdt+"*"+vclHgt);
                    }
                    // 购买(注册)日期
                    if (StringUtils.isNotEmpty(buyDate)){
                        String buyDateStr = DateUtils.formatDateToString(new Date(Long.parseLong(buyDate)), "yyyy-MM-dd");
                        resultMap.put("buyDate",buyDateStr);
                    }
                    // 首次入网时间
                    if (StringUtils.isNotEmpty(firstSysutc)){
                        Date date = new Date(Long.parseLong(firstSysutc));
                        String firstSysytcStr = DateUtils.formatDateToString(date, "yyyy-MM-dd");
                        resultMap.put("firstInterDate",firstSysytcStr);
                    }
                }
            }
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.获取参数结束:project:"+project);
        }catch (BaseException ex) {
            BaseLogUtils.info(logger,methodName, "获取授信记录初始化参数.DATA:" +  ex.getMessage(), ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,"获取参数异常");
        } catch (Exception ex) {
            BaseLogUtils.error(logger,methodName, "获取授信记录初始化参数.DATA:" + ex.getMessage(), ex);
            throw new BaseException(BaseExceptionConstant.COMMON_0002,"获取参数异常");
        }
    }
}

